Skip to content

Commit 84827a4

Browse files
authored
ci: cleanup cxx14 and cxx20 Dockerfiles (#12725)
Reduce inconsistencies between these Dockerfiles and between the different steps in the Dockerfiles themselves.
1 parent c116140 commit 84827a4

File tree

2 files changed

+32
-47
lines changed

2 files changed

+32
-47
lines changed

ci/cloudbuild/dockerfiles/fedora-latest-cxx14.Dockerfile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,32 +57,30 @@ RUN curl -fsSL https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.
5757
ldconfig
5858
ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig
5959

60-
# Install Abseil, remove the downloaded files and the temporary artifacts
61-
# after a successful build to keep the image smaller (and with fewer layers).
60+
# Download and install direct dependencies of `google-cloud-cpp`. Including
61+
# development dependencies. In each case, remove the downloaded files and the
62+
# temporary artifacts after a successful build to keep the image smaller (and
63+
# with fewer layers).
64+
6265
WORKDIR /var/tmp/build
6366
RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20230802.1.tar.gz | \
6467
tar -xzf - --strip-components=1 && \
6568
cmake \
6669
-DCMAKE_CXX_STANDARD=14 \
67-
-DCMAKE_BUILD_TYPE="Release" \
70+
-DCMAKE_BUILD_TYPE=Release \
6871
-DABSL_BUILD_TESTING=OFF \
6972
-DBUILD_SHARED_LIBS=yes \
7073
-GNinja -S . -B cmake-out && \
7174
cmake --build cmake-out && cmake --install cmake-out && \
7275
ldconfig && \
7376
cd /var/tmp && rm -fr build
7477

75-
# Download and install direct dependencies of `google-cloud-cpp`. Including
76-
# development dependencies. In each case, remove the downloaded files and the
77-
# temporary artifacts after a successful build to keep the image smaller (and
78-
# with fewer layers)
79-
8078
WORKDIR /var/tmp/build
8179
RUN curl -fsSL https://github.com/google/googletest/archive/v1.14.0.tar.gz | \
8280
tar -xzf - --strip-components=1 && \
8381
cmake \
8482
-DCMAKE_CXX_STANDARD=14 \
85-
-DCMAKE_BUILD_TYPE="Release" \
83+
-DCMAKE_BUILD_TYPE=Release \
8684
-DBUILD_SHARED_LIBS=yes \
8785
-GNinja -S . -B cmake-out && \
8886
cmake --build cmake-out && cmake --install cmake-out && \
@@ -94,7 +92,7 @@ RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.3.tar.gz | \
9492
tar -xzf - --strip-components=1 && \
9593
cmake \
9694
-DCMAKE_CXX_STANDARD=14 \
97-
-DCMAKE_BUILD_TYPE="Release" \
95+
-DCMAKE_BUILD_TYPE=Release \
9896
-DBUILD_SHARED_LIBS=yes \
9997
-DBENCHMARK_ENABLE_TESTING=OFF \
10098
-S . -B cmake-out && \

ci/cloudbuild/dockerfiles/fedora-latest-cxx20.Dockerfile

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ ARG ARCH=amd64
2121
# tools to compile the dependencies:
2222
RUN dnf makecache && \
2323
dnf install -y autoconf automake \
24-
clang clang-analyzer clang-tools-extra \
25-
cmake diffutils findutils gcc-c++ git \
26-
libcurl-devel llvm make ninja-build \
27-
openssl-devel patch python python3 \
24+
clang cmake diffutils findutils gcc-c++ git \
25+
make ninja-build patch python3 \
2826
python-pip tar unzip wget which zip zlib-devel
2927

28+
# Install the development packages for libcurl and OpenSSL. Neither are affected
29+
# by the C++ version, so we can use the pre-built binaries.
30+
RUN dnf makecache && \
31+
dnf install -y libcurl-devel openssl-devel
32+
3033
# Install the Python modules needed to run the storage emulator
3134
RUN dnf makecache && dnf install -y python3-devel
3235
RUN pip3 install --upgrade pip
3336
RUN pip3 install setuptools wheel
3437

35-
# This is needed to install gRPC
36-
RUN dnf makecache && dnf install -y c-ares-devel
37-
3838
# The Cloud Pub/Sub emulator needs Java, and so does `bazel coverage` :shrug:
3939
# Bazel needs the '-devel' version with javac.
4040
RUN dnf makecache && dnf install -y java-latest-openjdk-devel
@@ -59,23 +59,24 @@ RUN curl -fsSL https://pkgconfig.freedesktop.org/releases/pkg-config-0.29.2.tar.
5959
ldconfig
6060
ENV PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig
6161

62-
# Install Abseil, remove the downloaded files and the temporary artifacts
63-
# after a successful build to keep the image smaller (and with fewer layers)
62+
# Download and install direct dependencies of `google-cloud-cpp`. Including
63+
# development dependencies. In each case, remove the downloaded files and the
64+
# temporary artifacts after a successful build to keep the image smaller (and
65+
# with fewer layers).
66+
6467
WORKDIR /var/tmp/build
6568
RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20230802.1.tar.gz | \
6669
tar -xzf - --strip-components=1 && \
6770
cmake \
6871
-DCMAKE_CXX_STANDARD=20 \
69-
-DCMAKE_BUILD_TYPE="Release" \
72+
-DCMAKE_BUILD_TYPE=Release \
7073
-DABSL_BUILD_TESTING=OFF \
7174
-DBUILD_SHARED_LIBS=yes \
7275
-GNinja -S . -B cmake-out && \
73-
cmake --build cmake-out --target install && \
76+
cmake --build cmake-out && cmake --install cmake-out && \
7477
ldconfig && \
7578
cd /var/tmp && rm -fr build
7679

77-
# Install googletest, remove the downloaded files and the temporary artifacts
78-
# after a successful build to keep the image smaller (and with fewer layers)
7980
WORKDIR /var/tmp/build
8081
RUN curl -fsSL https://github.com/google/googletest/archive/v1.14.0.tar.gz | \
8182
tar -xzf - --strip-components=1 && \
@@ -84,11 +85,10 @@ RUN curl -fsSL https://github.com/google/googletest/archive/v1.14.0.tar.gz | \
8485
-DCMAKE_BUILD_TYPE=Release \
8586
-DBUILD_SHARED_LIBS=yes \
8687
-GNinja -S . -B cmake-out && \
87-
cmake --build cmake-out --target install && \
88+
cmake --build cmake-out && cmake --install cmake-out && \
8889
ldconfig && \
8990
cd /var/tmp && rm -fr build
9091

91-
# Download and compile Google microbenchmark support library:
9292
WORKDIR /var/tmp/build
9393
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.3.tar.gz | \
9494
tar -xzf - --strip-components=1 && \
@@ -97,8 +97,8 @@ RUN curl -fsSL https://github.com/google/benchmark/archive/v1.8.3.tar.gz | \
9797
-DCMAKE_BUILD_TYPE=Release \
9898
-DBUILD_SHARED_LIBS=yes \
9999
-DBENCHMARK_ENABLE_TESTING=OFF \
100-
-GNinja -S . -B cmake-out && \
101-
cmake --build cmake-out --target install && \
100+
-S . -B cmake-out && \
101+
cmake --build cmake-out && cmake --install cmake-out && \
102102
ldconfig && \
103103
cd /var/tmp && rm -fr build
104104

@@ -113,7 +113,7 @@ RUN curl -fsSL https://github.com/google/crc32c/archive/1.1.2.tar.gz | \
113113
-DCRC32C_BUILD_BENCHMARKS=OFF \
114114
-DCRC32C_USE_GLOG=OFF \
115115
-GNinja -S . -B cmake-out && \
116-
cmake --build cmake-out --target install && \
116+
cmake --build cmake-out && cmake --install cmake-out && \
117117
ldconfig && \
118118
cd /var/tmp && rm -fr build
119119

@@ -127,7 +127,7 @@ RUN curl -fsSL https://github.com/nlohmann/json/archive/v3.11.2.tar.gz | \
127127
-DBUILD_TESTING=OFF \
128128
-DJSON_BuildTests=OFF \
129129
-GNinja -S . -B cmake-out && \
130-
cmake --build cmake-out --target install && \
130+
cmake --build cmake-out && cmake --install cmake-out && \
131131
ldconfig && \
132132
cd /var/tmp && rm -fr build
133133

@@ -141,25 +141,12 @@ RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v24.3.tar.gz
141141
-Dprotobuf_BUILD_TESTS=OFF \
142142
-Dprotobuf_ABSL_PROVIDER=package \
143143
-GNinja -S . -B cmake-out && \
144-
cmake --build cmake-out --target install && \
144+
cmake --build cmake-out && cmake --install cmake-out && \
145145
ldconfig && \
146146
cd /var/tmp && rm -fr build
147147

148-
# The version of RE2 installed with Fedora:37 forces C++11 in its pkg-config
149-
# files. This may be fixed in Fedora:38, but until then it is easier to just
150-
# install the source code.
151-
WORKDIR /var/tmp/build/re2
152-
RUN curl -fsSL https://github.com/google/re2/archive/2023-09-01.tar.gz | \
153-
tar -xzf - --strip-components=1 && \
154-
cmake -DCMAKE_BUILD_TYPE=Release \
155-
-DBUILD_SHARED_LIBS=ON \
156-
-DRE2_BUILD_TESTING=OFF \
157-
-S . -B cmake-out && \
158-
cmake --build cmake-out -- -j ${NCPU:-4} && \
159-
cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
160-
ldconfig
161-
162148
WORKDIR /var/tmp/build/grpc
149+
RUN dnf makecache && dnf install -y c-ares-devel re2-devel
163150
RUN curl -fsSL https://github.com/grpc/grpc/archive/v1.58.1.tar.gz | \
164151
tar -xzf - --strip-components=1 && \
165152
cmake \
@@ -175,7 +162,7 @@ RUN curl -fsSL https://github.com/grpc/grpc/archive/v1.58.1.tar.gz | \
175162
-DgRPC_SSL_PROVIDER=package \
176163
-DgRPC_ZLIB_PROVIDER=package \
177164
-GNinja -S . -B cmake-out && \
178-
cmake --build cmake-out --target install && \
165+
cmake --build cmake-out && cmake --install cmake-out && \
179166
ldconfig && \
180167
cd /var/tmp && rm -fr build
181168

@@ -191,8 +178,8 @@ RUN curl -fsSL https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.11
191178
-DWITH_ABSEIL=ON \
192179
-DBUILD_TESTING=OFF \
193180
-DOPENTELEMETRY_INSTALL=ON \
194-
-S . -B cmake-out -GNinja && \
195-
cmake --build cmake-out --target install && \
181+
-GNinja -S . -B cmake-out && \
182+
cmake --build cmake-out && cmake --install cmake-out && \
196183
ldconfig && cd /var/tmp && rm -fr build
197184

198185
# Install the Cloud SDK and some of the emulators. We use the emulators to run

0 commit comments

Comments
 (0)