|
| 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