Skip to content

Commit 8a696b5

Browse files
committed
build: build a prelaunch image (#95)
* build: add build files to build a prelaunch image * naming * remove commented out code * copyright * checkers
1 parent 3801e3d commit 8a696b5

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
timeout: 7200s # 2 hours
16+
steps:
17+
- name: gcr.io/cloud-builders/docker
18+
args: ["build", "-t", "gcr.io/gcs-sdk-cloud-builds/cpp-storage-prelaunch:$SHORT_SHA",
19+
"-f", "ci/cloudbuild/dockerfiles/pre-launch.Dockerfile", "."]
20+
dir: .
21+
id: cpp-storage-prelaunch-build
22+
- name: gcr.io/cloud-builders/docker
23+
args:
24+
[
25+
"tag",
26+
"gcr.io/gcs-sdk-cloud-builds/cpp-storage-prelaunch:$SHORT_SHA",
27+
"gcr.io/gcs-sdk-cloud-builds/cpp-storage-prelaunch:latest",
28+
]
29+
30+
images:
31+
- gcr.io/gcs-sdk-cloud-builds/cpp-storage-prelaunch:$SHORT_SHA
32+
- gcr.io/gcs-sdk-cloud-builds/cpp-storage-prelaunch:latest
33+
34+
# If you do not set `logging` option, Cloud Build stores the
35+
# logs in both Cloud Logging and Cloud Storage.
36+
logsBucket: 'gs://gcs-sdk-cloud-builds-logs'
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM alpine:3.20 AS build
16+
17+
# Install the minimal development tools:
18+
RUN apk update && \
19+
apk add bash ca-certificates cmake curl git \
20+
gcc g++ make ninja-build ninja-is-really-ninja patch tar unzip zip zlib-dev
21+
22+
# The versions of Abseil (>= 20230802.1), Protobuf (>= v24.4), gRPC (>= 1.59.3),
23+
# OpenSSL, and nlohmann-json included with Alpine are good enough for this
24+
# benchmark.
25+
RUN apk update && \
26+
apk add abseil-cpp-dev crc32c-dev c-ares-dev curl-dev grpc-dev \
27+
protobuf-dev nlohmann-json openssl-dev re2-dev
28+
29+
# Alpine does not include a package for OpenTelemetry, so we compile it from
30+
# source.
31+
WORKDIR /var/tmp/build/opentelemetry-cpp
32+
RUN curl -fsSL https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.16.1.tar.gz | \
33+
tar -xzf - --strip-components=1 && \
34+
cmake \
35+
-G Ninja -S . -B .build \
36+
-DCMAKE_BUILD_TYPE=Release \
37+
-DWITH_EXAMPLES=OFF \
38+
-DWITH_ABSEIL=ON \
39+
-DBUILD_TESTING=OFF \
40+
-DOPENTELEMETRY_INSTALL=ON \
41+
-DOPENTELEMETRY_ABI_VERSION_NO=2 && \
42+
cmake --build .build && \
43+
cmake --install .build && \
44+
rm -fr .build
45+
46+
WORKDIR /var/tmp/build/google-cloud-cpp
47+
COPY . /var/tmp/build/google-cloud-cpp/
48+
RUN cmake \
49+
-G Ninja -S . -B .build \
50+
-DCMAKE_BUILD_TYPE=Release \
51+
-DBUILD_TESTING=OFF \
52+
-DGOOGLE_CLOUD_CPP_WITH_MOCKS=OFF \
53+
-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES=OFF \
54+
-DGOOGLE_CLOUD_CPP_ENABLE=storage,storage_grpc,monitoring,opentelemetry && \
55+
cmake --build .build && \
56+
cmake --install .build && \
57+
rm -fr .build
58+
59+
RUN apk update && \
60+
apk add boost-dev
61+
62+
# Update the ld.conf cache in case any libraries were installed in /usr/local/lib*
63+
RUN ldconfig /usr/local/lib*

0 commit comments

Comments
 (0)