|
| 1 | +# Copyright 2021 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 ubuntu:22.04 |
| 16 | + |
| 17 | +ENV DEBIAN_FRONTEND=noninteractive |
| 18 | +RUN apt-get update && \ |
| 19 | + apt-get --no-install-recommends install -y \ |
| 20 | + automake \ |
| 21 | + build-essential \ |
| 22 | + clang \ |
| 23 | + cmake \ |
| 24 | + curl \ |
| 25 | + gawk \ |
| 26 | + git \ |
| 27 | + gcc \ |
| 28 | + g++ \ |
| 29 | + libcurl4-openssl-dev \ |
| 30 | + libssl-dev \ |
| 31 | + libtool \ |
| 32 | + lsb-release \ |
| 33 | + make \ |
| 34 | + ninja-build \ |
| 35 | + patch \ |
| 36 | + pkg-config \ |
| 37 | + python3 \ |
| 38 | + python3-dev \ |
| 39 | + python3-pip \ |
| 40 | + tar \ |
| 41 | + unzip \ |
| 42 | + zip \ |
| 43 | + wget \ |
| 44 | + zlib1g-dev \ |
| 45 | + apt-utils \ |
| 46 | + ca-certificates \ |
| 47 | + apt-transport-https |
| 48 | + |
| 49 | +# Install Python packages used in the integration tests. |
| 50 | +RUN update-alternatives --install /usr/bin/python python $(which python3) 10 |
| 51 | +RUN pip3 install setuptools wheel |
| 52 | +# The Cloud Pub/Sub emulator needs Java :shrug: |
| 53 | +RUN apt update && apt install -y openjdk-11-jre |
| 54 | + |
| 55 | +# Install all the direct (and indirect) dependencies for google-cloud-cpp. |
| 56 | +# Use a different directory for each build, and remove the downloaded |
| 57 | +# files and any temporary artifacts after a successful build to keep the |
| 58 | +# image smaller (and with fewer layers) |
| 59 | + |
| 60 | +WORKDIR /var/tmp/build/abseil-cpp |
| 61 | +RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20250814.1.tar.gz | \ |
| 62 | + tar -xzf - --strip-components=1 && \ |
| 63 | + cmake \ |
| 64 | + -DCMAKE_BUILD_TYPE="Release" \ |
| 65 | + -DCMAKE_CXX_STANDARD=17 \ |
| 66 | + -DABSL_BUILD_TESTING=OFF \ |
| 67 | + -DBUILD_SHARED_LIBS=yes \ |
| 68 | + -S . -B cmake-out -GNinja && \ |
| 69 | + cmake --build cmake-out --target install && \ |
| 70 | + ldconfig && \ |
| 71 | + cd /var/tmp && rm -fr build |
| 72 | + |
| 73 | +WORKDIR /var/tmp/build/googletest |
| 74 | +RUN curl -fsSL https://github.com/google/googletest/archive/v1.16.0.tar.gz | \ |
| 75 | + tar -xzf - --strip-components=1 && \ |
| 76 | + cmake \ |
| 77 | + -DCMAKE_BUILD_TYPE="Release" \ |
| 78 | + -DCMAKE_CXX_STANDARD=17 \ |
| 79 | + -DBUILD_SHARED_LIBS=yes \ |
| 80 | + -S . -B cmake-out -GNinja && \ |
| 81 | + cmake --build cmake-out --target install && \ |
| 82 | + ldconfig && \ |
| 83 | + cd /var/tmp && rm -fr build |
| 84 | + |
| 85 | +WORKDIR /var/tmp/build/benchmark |
| 86 | +RUN curl -fsSL https://github.com/google/benchmark/archive/v1.9.2.tar.gz | \ |
| 87 | + tar -xzf - --strip-components=1 && \ |
| 88 | + cmake \ |
| 89 | + -DCMAKE_BUILD_TYPE="Release" \ |
| 90 | + -DBUILD_SHARED_LIBS=yes \ |
| 91 | + -DBENCHMARK_ENABLE_TESTING=OFF \ |
| 92 | + -S . -B cmake-out -GNinja && \ |
| 93 | + cmake --build cmake-out --target install && \ |
| 94 | + ldconfig && \ |
| 95 | + cd /var/tmp && rm -fr build |
| 96 | + |
| 97 | +WORKDIR /var/tmp/build/nlohmann-json |
| 98 | +RUN curl -fsSL https://github.com/nlohmann/json/archive/v3.11.3.tar.gz | \ |
| 99 | + tar -xzf - --strip-components=1 && \ |
| 100 | + cmake \ |
| 101 | + -DCMAKE_BUILD_TYPE="Release" \ |
| 102 | + -DBUILD_SHARED_LIBS=yes \ |
| 103 | + -DBUILD_TESTING=OFF \ |
| 104 | + -DJSON_BuildTests=OFF \ |
| 105 | + -S . -B cmake-out -GNinja && \ |
| 106 | + cmake --build cmake-out --target install && \ |
| 107 | + ldconfig && \ |
| 108 | + cd /var/tmp && rm -fr build |
| 109 | + |
| 110 | + |
| 111 | +WORKDIR /var/tmp/build/protobuf |
| 112 | +RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v33.1.tar.gz | \ |
| 113 | + tar -xzf - --strip-components=1 && \ |
| 114 | + cmake \ |
| 115 | + -DCMAKE_BUILD_TYPE=Release \ |
| 116 | + -DCMAKE_CXX_STANDARD=17 \ |
| 117 | + -DBUILD_SHARED_LIBS=yes \ |
| 118 | + -Dprotobuf_BUILD_TESTS=OFF \ |
| 119 | + -Dprotobuf_ABSL_PROVIDER=package \ |
| 120 | + -S . -B cmake-out -GNinja && \ |
| 121 | + cmake --build cmake-out --target install && \ |
| 122 | + ldconfig && \ |
| 123 | + cd /var/tmp && rm -fr build |
| 124 | + |
| 125 | +WORKDIR /var/tmp/build/c-ares |
| 126 | +RUN curl -fsSL https://github.com/c-ares/c-ares/archive/refs/tags/cares-1_17_1.tar.gz | \ |
| 127 | + tar -xzf - --strip-components=1 && \ |
| 128 | + cmake \ |
| 129 | + -DCMAKE_BUILD_TYPE=Release \ |
| 130 | + -DBUILD_SHARED_LIBS=yes \ |
| 131 | + -S . -B cmake-out -GNinja && \ |
| 132 | + cmake --build cmake-out --target install && \ |
| 133 | + ldconfig && \ |
| 134 | + cd /var/tmp && rm -fr build |
| 135 | + |
| 136 | +WORKDIR /var/tmp/build/re2 |
| 137 | +RUN curl -fsSL https://github.com/google/re2/archive/2025-07-22.tar.gz | \ |
| 138 | + tar -xzf - --strip-components=1 && \ |
| 139 | + cmake -DCMAKE_BUILD_TYPE=Release \ |
| 140 | + -DBUILD_SHARED_LIBS=ON \ |
| 141 | + -DRE2_BUILD_TESTING=OFF \ |
| 142 | + -S . -B cmake-out -GNinja && \ |
| 143 | + cmake --build cmake-out --target install && \ |
| 144 | + ldconfig && \ |
| 145 | + cd /var/tmp && rm -fr build |
| 146 | + |
| 147 | +WORKDIR /var/tmp/build/ |
| 148 | +RUN curl -fsSL https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.24.0.tar.gz | \ |
| 149 | + tar -xzf - --strip-components=1 && \ |
| 150 | + cmake \ |
| 151 | + -DCMAKE_CXX_STANDARD=17 \ |
| 152 | + -DCMAKE_BUILD_TYPE=Release \ |
| 153 | + -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ |
| 154 | + -DBUILD_SHARED_LIBS=ON \ |
| 155 | + -DWITH_EXAMPLES=OFF \ |
| 156 | + -DWITH_STL=CXX17 \ |
| 157 | + -DBUILD_TESTING=OFF \ |
| 158 | + -DOPENTELEMETRY_INSTALL=ON \ |
| 159 | + -DOPENTELEMETRY_ABI_VERSION_NO=2 \ |
| 160 | + -S . -B cmake-out -GNinja && \ |
| 161 | + cmake --build cmake-out --target install && \ |
| 162 | + ldconfig && cd /var/tmp && rm -fr build |
| 163 | + |
| 164 | +WORKDIR /var/tmp/build/grpc |
| 165 | +RUN curl -fsSL https://github.com/grpc/grpc/archive/v1.76.0.tar.gz | \ |
| 166 | + tar -xzf - --strip-components=1 && \ |
| 167 | + cmake \ |
| 168 | + -DCMAKE_BUILD_TYPE=Release \ |
| 169 | + -DCMAKE_CXX_STANDARD=17 \ |
| 170 | + -DBUILD_SHARED_LIBS=ON \ |
| 171 | + -DgRPC_INSTALL=ON \ |
| 172 | + -DgRPC_BUILD_TESTS=OFF \ |
| 173 | + -DgRPC_ABSL_PROVIDER=package \ |
| 174 | + -DgRPC_CARES_PROVIDER=package \ |
| 175 | + -DgRPC_PROTOBUF_PROVIDER=package \ |
| 176 | + -DgRPC_RE2_PROVIDER=package \ |
| 177 | + -DgRPC_SSL_PROVIDER=package \ |
| 178 | + -DgRPC_ZLIB_PROVIDER=package \ |
| 179 | + -DgRPC_OPENTELEMETRY_PROVIDER=package \ |
| 180 | + -DgRPC_BUILD_GRPCPP_OTEL_PLUGIN=ON \ |
| 181 | + -S . -B cmake-out -GNinja && \ |
| 182 | + cmake --build cmake-out --target install && \ |
| 183 | + ldconfig && \ |
| 184 | + cd /var/tmp && rm -fr build |
| 185 | + |
| 186 | +# Install the Cloud SDK and some of the emulators. We use the emulators to run |
| 187 | +# integration tests for the client libraries. |
| 188 | +COPY . /var/tmp/ci |
| 189 | +WORKDIR /var/tmp/downloads |
| 190 | +RUN /var/tmp/ci/install-cloud-sdk.sh |
| 191 | +ENV CLOUD_SDK_LOCATION=/usr/local/google-cloud-sdk |
| 192 | +ENV PATH=${CLOUD_SDK_LOCATION}/bin:${PATH} |
| 193 | + |
| 194 | +WORKDIR /var/tmp/sccache |
| 195 | +RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-x86_64-unknown-linux-musl.tar.gz | \ |
| 196 | + tar -zxf - --strip-components=1 && \ |
| 197 | + mkdir -p /usr/local/bin && \ |
| 198 | + mv sccache /usr/local/bin/sccache && \ |
| 199 | + chmod +x /usr/local/bin/sccache |
| 200 | + |
| 201 | +# Update the ld.conf cache in case any libraries were installed in /usr/local/lib* |
| 202 | +RUN ldconfig /usr/local/lib* |
0 commit comments