forked from googleapis/google-cloud-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgcc-oldest.Dockerfile
More file actions
152 lines (138 loc) · 5.81 KB
/
gcc-oldest.Dockerfile
File metadata and controls
152 lines (138 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM opensuse/leap:15
ARG NCPU=4
RUN zypper refresh && \
zypper install --allow-downgrade -y automake cmake curl gcc gcc-c++ \
git gzip libtool make ninja patch tar wget \
c-ares-devel libcurl-devel libopenssl-devel libcrc32c-devel
RUN (echo "/usr/local/lib" ; echo "/usr/local/lib64") | \
tee /etc/ld.so.conf.d/usrlocal.conf
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig
ENV PATH=/usr/local/bin:${PATH}
WORKDIR /var/tmp/build
RUN curl -fsSL https://github.com/abseil/abseil-cpp/archive/20250127.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=Release \
-DABSL_BUILD_TESTING=OFF \
-DBUILD_SHARED_LIBS=yes \
-GNinja -S . -B cmake-out && \
cmake --build cmake-out && cmake --install cmake-out && \
ldconfig && \
cd /var/tmp && rm -fr build
WORKDIR /var/tmp/build/re2
RUN curl -fsSL https://github.com/google/re2/archive/2024-07-02.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=ON \
-DRE2_BUILD_TESTING=OFF \
-S . -B cmake-out && \
cmake --build cmake-out -- -j ${NCPU:-4} && \
cmake --build cmake-out --target install -- -j ${NCPU:-4} && \
ldconfig && \
cd /var/tmp && rm -fr build
# Install googletest, remove the downloaded files and the temporary artifacts
# after a successful build to keep the image smaller (and with fewer layers)
WORKDIR /var/tmp/build
RUN curl -fsSL https://github.com/google/googletest/archive/v1.16.0.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=yes \
-GNinja -S . -B cmake-out && \
cmake --build cmake-out && cmake --install cmake-out && \
ldconfig && cd /var/tmp && rm -fr build
# Download and compile Google microbenchmark support library:
WORKDIR /var/tmp/build
RUN curl -fsSL https://github.com/google/benchmark/archive/v1.9.2.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_SHARED_LIBS=yes \
-DBENCHMARK_ENABLE_TESTING=OFF \
-GNinja -S . -B cmake-out && \
cmake --build cmake-out && cmake --install cmake-out && \
ldconfig && cd /var/tmp && rm -fr build
WORKDIR /var/tmp/build/protobuf
RUN curl -fsSL https://github.com/protocolbuffers/protobuf/archive/v31.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=yes \
-Dprotobuf_BUILD_TESTS=OFF \
-Dprotobuf_ABSL_PROVIDER=package \
-GNinja -S . -B cmake-out && \
cmake --build cmake-out && cmake --install cmake-out && \
ldconfig && cd /var/tmp && rm -fr build
# We need to patch opentelemetry-cpp to work around a compiler bug in (at least)
# GCC 7.x. See https://github.com/open-telemetry/opentelemetry-cpp/issues/1014
# for more details.
WORKDIR /var/tmp/build/opentelemetry-cpp
RUN curl -fsSL https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.24.0.tar.gz | \
tar -xzf - --strip-components=1 && \
sed -i 's/Stack &GetStack()/Stack \&GetStack() __attribute__((noinline, noclone))/' "api/include/opentelemetry/context/runtime_context.h" && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=yes \
-DWITH_EXAMPLES=OFF \
-DWITH_STL=CXX17 \
-DBUILD_TESTING=OFF \
-DOPENTELEMETRY_INSTALL=ON \
-DOPENTELEMETRY_ABI_VERSION_NO=2 \
-GNinja -S . -B cmake-out && \
cmake --build cmake-out && cmake --install cmake-out && \
ldconfig && cd /var/tmp && rm -fr build
WORKDIR /var/tmp/build/grpc
RUN curl -fsSL https://github.com/grpc/grpc/archive/v1.74.1.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=yes \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DgRPC_ABSL_PROVIDER=package \
-DgRPC_CARES_PROVIDER=package \
-DgRPC_PROTOBUF_PROVIDER=package \
-DgRPC_RE2_PROVIDER=package \
-DgRPC_SSL_PROVIDER=package \
-DgRPC_ZLIB_PROVIDER=package \
-GNinja -S . -B cmake-out && \
cmake --build cmake-out && cmake --install cmake-out && \
ldconfig && cd /var/tmp && rm -fr build
WORKDIR /var/tmp/build
RUN curl -fsSL https://github.com/nlohmann/json/archive/v3.11.3.tar.gz | \
tar -xzf - --strip-components=1 && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_TESTING=OFF \
-DJSON_BuildTests=OFF \
-GNinja -S . -B cmake-out && \
cmake --build cmake-out --target install && \
ldconfig && cd /var/tmp && rm -fr build
WORKDIR /var/tmp/sccache
RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-x86_64-unknown-linux-musl.tar.gz | \
tar -zxf - --strip-components=1 && \
mkdir -p /usr/local/bin && \
mv sccache /usr/local/bin/sccache && \
chmod +x /usr/local/bin/sccache
# Update the ld.conf cache in case any libraries were installed in /usr/local/lib*
RUN ldconfig /usr/local/lib*