@@ -10,23 +10,26 @@ RUN set -ex; \
1010 else \
1111 apt-get update && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y install wget curl file libgmp-dev libmpfr-dev libmpc-dev gcc g++ bzip2 libbz2-dev libssl-dev zlib1g-dev libreadline-dev libffi-dev make tzdata ; \
1212 fi
13+ ARG build_platform=bazel
1314RUN set -ex; \
14- if [ "$toolchain_version" = "v3" ]; then \
15- wget https://gcc.gnu.org/pub/gcc/releases/gcc-8.5.0/gcc-8.5.0.tar.gz -O gcc.tar.gz; \
16- fi; \
17- if [ "$toolchain_version" = "v4" ]; then \
18- wget https://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/gcc-11.3.0.tar.gz -O gcc.tar.gz; \
19- fi; \
20- if [ "$toolchain_version" = "v5" ]; then \
21- wget https://gcc.gnu.org/pub/gcc/releases/gcc-14.2.0/gcc-14.2.0.tar.gz -O gcc.tar.gz; \
22- fi; \
23- mkdir -p /opt/src/gcc && tar -xf gcc.tar.gz -C /opt/src/gcc --strip-components=1; \
24- cd /opt/src/gcc && ./contrib/download_prerequisites; \
25- mkdir /opt/objdir && cd /opt/objdir; \
26- CFLAGS="-O2" CXXFLAGS="-O2" /opt/src/gcc/configure --disable-multilib --prefix=/opt/gcc --enable-languages=c,c++; \
27- make -j "$(nproc)"; \
28- make install-strip; \
29- cd /opt && rm -rf /opt/src/gcc && rm -rf /opt/gcc.tar.gz && rm -rf /opt/objdir
15+ if [ "$build_platform" = "scons" ]; then \
16+ if [ "$toolchain_version" = "v3" ]; then \
17+ wget https://gcc.gnu.org/pub/gcc/releases/gcc-8.5.0/gcc-8.5.0.tar.gz -O gcc.tar.gz; \
18+ fi; \
19+ if [ "$toolchain_version" = "v4" ]; then \
20+ wget https://gcc.gnu.org/pub/gcc/releases/gcc-11.3.0/gcc-11.3.0.tar.gz -O gcc.tar.gz; \
21+ fi; \
22+ if [ "$toolchain_version" = "v5" ]; then \
23+ wget https://gcc.gnu.org/pub/gcc/releases/gcc-14.2.0/gcc-14.2.0.tar.gz -O gcc.tar.gz; \
24+ fi; \
25+ mkdir -p /opt/src/gcc && tar -xf gcc.tar.gz -C /opt/src/gcc --strip-components=1; \
26+ cd /opt/src/gcc && ./contrib/download_prerequisites; \
27+ mkdir /opt/objdir && cd /opt/objdir; \
28+ CFLAGS="-O2" CXXFLAGS="-O2" /opt/src/gcc/configure --disable-multilib --prefix=/opt/gcc --enable-languages=c,c++; \
29+ make -j "$(nproc)"; \
30+ make install-strip; \
31+ cd /opt && rm -rf /opt/src/gcc && rm -rf /opt/gcc.tar.gz && rm -rf /opt/objdir; \
32+ fi
3033ENV PATH="/opt/gcc/bin:${PATH}"
3134RUN set -ex; \
3235 if [ "$toolchain_version" = "v3" ]; then \
@@ -48,12 +51,37 @@ RUN set -ex; \
4851 wget https://github.com/bazelbuild/bazel/releases/download/${bazel_version}/bazel-${bazel_version}-linux-${TARGETARCH} -O /opt/bazel/bazel && \
4952 chmod +x /opt/bazel/bazel ;\
5053 fi
54+ RUN set -ex; \
55+ if [ -f "/usr/bin/yum" ] ; then \
56+ yum -y update && yum install -y --allowerasing diffutils wget git curl cmake lld binutils glibc-devel tzdata openssl-devel libcurl-devel; \
57+ else \
58+ apt-get update && apt-get -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -y install wget curl git cmake binutils lld tzdata libssl-dev libcurl4-openssl-dev; \
59+ fi
60+ ENV CMAKE_C_FLAGS=" -Wno-error=uninitialized "
61+ ENV CMAKE_CXX_FLAGS=" -Wno-error=deprecated-declarations -Wno-error=uninitialized "
62+ ARG AWS_VERSION=1.9.379
63+ RUN cd /opt && git clone --branch $AWS_VERSION --single-branch https://github.com/aws/aws-sdk-cpp.git && \
64+ mkdir -p /opt/aws && \
65+ cd aws-sdk-cpp && git submodule update --init --recursive && \
66+ mkdir build && cd build && \
67+ cmake .. -DCMAKE_C_FLAGS="$CMAKE_C_FLAGS" -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="/opt/aws" -DAUTORUN_UNIT_TESTS=OFF && \
68+ make -j "$(nproc)" && make install && \
69+ cd /opt && rm -rf aws-sdk-cpp
70+ ARG E2FS_VERSION=v1.47.2
71+ RUN cd /opt && git clone --branch $E2FS_VERSION --single-branch https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git && \
72+ mkdir -p /opt/e2fs && cd e2fsprogs && \
73+ mkdir build && cd build && \
74+ ../configure --prefix=/opt/e2fs && \
75+ make -j "$(nproc)" && make install-libs && \
76+ cd /opt && rm -rf e2fsprogs
5177
5278ARG OS=debian:12
5379FROM $OS AS toolchain
5480COPY --from=toolchain_builder /opt /opt
5581ENV PATH="/opt/python/bin:/opt/gcc/bin:/opt/bazel:${PATH}"
5682RUN set -ex; \
83+ cp -r /opt/aws/* /usr/ && cp -r /opt/e2fs/* /usr/ && \
84+ rm -rf /opt/aws && rm -rf /opt/e2fs && \
5785 if [ -f "/usr/bin/yum" ] ; then \
5886 yum -y update && yum install -y --allowerasing diffutils wget git curl cmake lld binutils glibc-devel tzdata; \
5987 else \
@@ -66,8 +94,6 @@ ENV POETRY_VIRTUALENVS_CREATE=false
6694ENV POETRY_INSTALLER_MAX_WORKERS=10
6795ENV PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
6896ENV GLIBC_TUNABLES=glibc.pthread.rseq=0
69- ENV CC=/opt/gcc/bin/gcc
70- ENV CXX=/opt/gcc/bin/g++
7197ENV PYTHON_BIN_PATH=/opt/venv/bin/python
7298
7399FROM toolchain AS base_image
@@ -76,7 +102,7 @@ ARG psm_ver=8.0.13
76102ARG psm_release=4
77103ARG repo=https://github.com/percona/percona-server-mongodb.git
78104RUN cd /opt && mkdir -p percona-server-mongodb && \
79- git clone $repo percona-server-mongodb && \
105+ git clone --branch $branch --single-branch $repo percona-server-mongodb && \
80106 cd percona-server-mongodb/ && \
81107 git checkout $branch && git pull && \
82108 REVISION_LONG=$(git rev-parse HEAD) && \
@@ -107,24 +133,6 @@ RUN set -ex; \
107133 pip install --upgrade referencing==0.35.1 && \
108134 pip install -r etc/pip/dev-requirements.txt; \
109135 fi
110- ENV CMAKE_C_FLAGS=" -Wno-error=uninitialized "
111- ENV CMAKE_CXX_FLAGS=" -Wno-error=deprecated-declarations -Wno-error=uninitialized "
112- ARG AWS_VERSION=1.9.379
113- RUN cd /opt && git clone https://github.com/aws/aws-sdk-cpp.git && \
114- mkdir -p /opt/aws && \
115- cd aws-sdk-cpp && git checkout $AWS_VERSION && git submodule update --init --recursive && \
116- mkdir build && cd build && \
117- cmake .. -DCMAKE_C_FLAGS="$CMAKE_C_FLAGS" -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" -DCMAKE_BUILD_TYPE=Release -DBUILD_ONLY="s3;transfer" -DBUILD_SHARED_LIBS=OFF -DMINIMIZE_SIZE=ON -DCMAKE_INSTALL_PREFIX="/usr" -DAUTORUN_UNIT_TESTS=OFF && \
118- make -j "$(nproc)" && make install && \
119- cd /opt && rm -rf aws-sdk-cpp
120- ARG E2FS_VERSION=v1.47.2
121- RUN cd /opt && git clone https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git && \
122- mkdir -p /opt/e2fs && \
123- cd e2fsprogs && git checkout $E2FS_VERSION && \
124- mkdir build && cd build && \
125- ../configure --prefix=/usr && \
126- make -j "$(nproc)" && make install-libs && \
127- cd /opt && rm -rf e2fsprogs
128136RUN /usr/bin/echo -e "\n\
129137CC = \"/opt/gcc/bin/gcc\"\n\
130138CXX = \"/opt/gcc/bin/g++\"\n\
@@ -185,13 +193,24 @@ RUN set -ex; \
185193 --ssl --link-model=dynamic --linker=gold --dbg=off --opt=off $ff --use-sasl-client --wiredtiger --audit --inmemory --hotbackup install-unittests ;\
186194 fi
187195
196+ FROM base_image AS jstests
197+ COPY --from=psmdb_builder /opt/percona-server-mongodb/build/install/bin/* /usr/bin/
198+ RUN find jstests -type f | xargs chmod 400 && \
199+ cp /usr/bin/dbtest . || true && \
200+ support-files/ldap-sasl/deploy_ldap_and_sasl.sh || true && \
201+ echo "START=yes" >> /etc/default/saslauthd || true
202+ ENV PATH="${PATH}:/data/multiversion"
203+ ENV PYTHONPATH="/opt/percona-server-mongodb:/opt/percona-server-mongodb/src"
204+ ENV TZ=America/New_York
205+ ENV PORTABLE=1
206+ ENV USE_SSE=1
207+ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
208+ RUN useradd -u 1001 -r -g 0 -m -s /sbin/nologin -c "Default Application User" mongodb || true
209+
188210FROM base_image AS integrationtests
211+ COPY --from=psmdb_builder /opt/percona-server-mongodb/build/install/bin/* /usr/bin/
189212ARG build_platform=bazel
190213ARG pro=true
191- RUN useradd -u 1001 -g 0 -m -c "Default Application User" mongodb && \
192- chown -R mongodb /opt && chown -R mongodb /data/db && mkdir /work && chown -R mongodb /work
193- USER mongodb
194- ENV PATH="/home/mongodb/.local/bin:${PATH}"
195214RUN set -ex; \
196215 ff="" ;\
197216 if [ "$pro" = "true" ] && [ "$build_platform" = "bazel" ]; then \
@@ -211,10 +230,6 @@ RUN set -ex; \
211230FROM base_image AS benchmarks
212231ARG build_platform=bazel
213232ARG pro=true
214- RUN useradd -u 1001 -g 0 -m -c "Default Application User" mongodb && \
215- chown -R mongodb /opt && chown -R mongodb /data/db && mkdir /work && chown -R mongodb /work
216- USER mongodb
217- ENV PATH="/home/mongodb/.local/bin:${PATH}"
218233RUN set -ex; \
219234 ff="" ;\
220235 if [ "$pro" = "true" ] && [ "$build_platform" = "bazel" ]; then \
@@ -231,16 +246,3 @@ RUN set -ex; \
231246 --ssl --link-model=dynamic --linker=gold --dbg=off --opt=off $ff --use-sasl-client --wiredtiger --audit --inmemory --hotbackup install-benchmarks ;\
232247 fi
233248
234- FROM base_image AS jstests
235- COPY --from=psmdb_builder /opt/percona-server-mongodb/build/install/bin/* /usr/bin/
236- RUN find jstests -type f | xargs chmod 400 && \
237- cp /usr/bin/dbtest . || true && \
238- support-files/ldap-sasl/deploy_ldap_and_sasl.sh || true && \
239- echo "START=yes" >> /etc/default/saslauthd || true
240- ENV PATH="${PATH}:/data/multiversion"
241- ENV PYTHONPATH="/opt/percona-server-mongodb:/opt/percona-server-mongodb/src"
242- ENV TZ=America/New_York
243- ENV PORTABLE=1
244- ENV USE_SSE=1
245- RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
246- RUN useradd -u 1001 -r -g 0 -m -s /sbin/nologin -c "Default Application User" mongodb || true
0 commit comments