@@ -3,9 +3,8 @@ ARG TOKENSERVER_DATABASE_BACKEND=mysql
33# Alternatively MYSQLCLIENT_PKG=libmysqlclient-dev for the Oracle/MySQL official client
44ARG MYSQLCLIENT_PKG=libmariadb-dev-compat
55
6- FROM python:3.14-bookworm AS python-base
7-
8- # NOTE: Ensure builder's Rust version matches CI's in .github/ directory.
6+ # NOTE: Ensure builder's Rust version matches CI's in .circleci/config.yml
7+ # RUST_VER
98FROM docker.io/lukemathwalker/cargo-chef:0.1.73-rust-1.91.1-bookworm AS chef
109WORKDIR /app
1110
@@ -18,28 +17,26 @@ ARG SYNCSTORAGE_DATABASE_BACKEND
1817ARG TOKENSERVER_DATABASE_BACKEND
1918ARG MYSQLCLIENT_PKG
2019
21- COPY --from=python-base /usr/local /usr/local
22-
2320RUN apt-get -q update && \
2421 MYSQL_PKG="" && \
2522 POSTGRES_DEV_PKG="" && \
2623 if [ "$SYNCSTORAGE_DATABASE_BACKEND" = "mysql" ] || [ "$TOKENSERVER_DATABASE_BACKEND" = "mysql" ]; then \
27- MYSQL_PKG="$MYSQLCLIENT_PKG" ; \
28- if [ "$MYSQLCLIENT_PKG" = libmysqlclient-dev ] ; then \
29- # First install gnupg and setup MySQL repo
30- # Key ID A8D3785C from https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html
31- apt-get -q install -y --no-install-recommends gnupg ca-certificates && \
32- echo "deb https://repo.mysql.com/apt/debian/ bookworm mysql-8.0" >> /etc/apt/sources.list && \
33- # Fetch and install the MySQL public key
34- gpg --batch --keyserver hkp://keyserver.ubuntu.com --recv-keys A8D3785C && \
35- gpg --batch --armor --export A8D3785C | tee /etc/apt/trusted.gpg.d/mysql.asc && \
36- apt-get -q update ; \
37- fi; \
24+ MYSQL_PKG="$MYSQLCLIENT_PKG" ; \
25+ if [ "$MYSQLCLIENT_PKG" = libmysqlclient-dev ] ; then \
26+ # First install gnupg and setup MySQL repo
27+ # Key ID A8D3785C from https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html
28+ apt-get -q install -y --no-install-recommends gnupg ca-certificates && \
29+ echo "deb https://repo.mysql.com/apt/debian/ bookworm mysql-8.0" >> /etc/apt/sources.list && \
30+ # Fetch and install the MySQL public key
31+ gpg --batch --keyserver hkp://keyserver.ubuntu.com --recv-keys A8D3785C && \
32+ gpg --batch --armor --export A8D3785C | tee /etc/apt/trusted.gpg.d/mysql.asc && \
33+ apt-get -q update ; \
34+ fi; \
3835 fi && \
3936 if [ "$TOKENSERVER_DATABASE_BACKEND" = "postgres" ]; then \
40- POSTGRES_DEV_PKG="libpq-dev" ; \
37+ POSTGRES_DEV_PKG="libpq-dev" ; \
4138 fi && \
42- apt-get -q install -y --no-install-recommends $MYSQL_PKG $POSTGRES_DEV_PKG cmake pkg-config && \
39+ apt-get -q install -y --no-install-recommends $MYSQL_PKG $POSTGRES_DEV_PKG cmake python3-dev python3-pip python3-setuptools python3-wheel python3-venv pkg-config && \
4340 rm -rf /var/lib/apt/lists/*
4441
4542COPY --from=planner /app/recipe.json recipe.json
@@ -50,7 +47,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
5047 set -x && \
5148 TOKENSERVER_FEATURES="" && \
5249 if [ "$TOKENSERVER_DATABASE_BACKEND" = "postgres" ]; then \
53- TOKENSERVER_FEATURES="--features=tokenserver-db/postgres" ; \
50+ TOKENSERVER_FEATURES="--features=tokenserver-db/postgres" ; \
5451 fi && \
5552 cargo chef cook --release --no-default-features --features=syncstorage-db/$SYNCSTORAGE_DATABASE_BACKEND $TOKENSERVER_FEATURES --features=py_verifier --recipe-path recipe.json
5653
@@ -76,11 +73,11 @@ RUN poetry export --no-interaction --without dev --output requirements.txt --wit
7673 poetry export --no-interaction --without dev --output requirements.txt --without-hashes && \
7774 cd /app/tools/postgres && \
7875 if [ "$SYNCSTORAGE_DATABASE_BACKEND" = "postgres" ]; then \
79- poetry export --no-interaction --without dev --output requirements.txt --without-hashes; \
76+ poetry export --no-interaction --without dev --output requirements.txt --without-hashes; \
8077 else \
81- # Because we can't conditionally COPY files in the next stage, generate
82- # this empty requirements.txt file so that we can always COPY it
83- touch requirements.txt; \
78+ # Because we can't conditionally COPY files in the next stage, generate
79+ # this empty requirements.txt file so that we can always COPY it
80+ touch requirements.txt; \
8481 fi && \
8582 cd /app
8683
@@ -90,7 +87,7 @@ RUN mkdir -p /app/wheels && \
9087 pip3 wheel --no-cache-dir -r /app/tools/integration_tests/requirements.txt -w /app/wheels && \
9188 pip3 wheel --no-cache-dir -r /app/tools/tokenserver/requirements.txt -w /app/wheels && \
9289 if [ "$SYNCSTORAGE_DATABASE_BACKEND" = "postgres" ] && [ -f /app/tools/postgres/requirements.txt ]; then \
93- pip3 wheel --no-cache-dir -r /app/tools/postgres/requirements.txt -w /app/wheels; \
90+ pip3 wheel --no-cache-dir -r /app/tools/postgres/requirements.txt -w /app/wheels; \
9491 fi
9592
9693ENV PATH=$PATH:/root/.cargo/bin
@@ -101,13 +98,13 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
10198 set -x && \
10299 TOKENSERVER_FEATURES="" && \
103100 if [ "$TOKENSERVER_DATABASE_BACKEND" = "postgres" ]; then \
104- TOKENSERVER_FEATURES="--features=tokenserver-db/postgres" ; \
101+ TOKENSERVER_FEATURES="--features=tokenserver-db/postgres" ; \
105102 fi && \
106103 cargo --version && \
107104 rustc --version && \
108105 cargo install --path ./syncserver --no-default-features --features=syncstorage-db/$SYNCSTORAGE_DATABASE_BACKEND $TOKENSERVER_FEATURES --features=py_verifier --locked --root /app
109106
110- FROM python:3.14 -slim-bookworm
107+ FROM docker.io/library/debian:bookworm -slim
111108ARG SYNCSTORAGE_DATABASE_BACKEND
112109ARG TOKENSERVER_DATABASE_BACKEND
113110ARG MYSQLCLIENT_PKG
@@ -118,16 +115,21 @@ RUN apt-get -q update && \
118115 # Always install MySQL libs because Python integration tests depend on mysqlclient
119116 MYSQL_PKG="$MYSQLCLIENT_PKG" && \
120117 if [ "$MYSQLCLIENT_PKG" = libmysqlclient-dev ] ; then \
121- # First install gnupg and setup MySQL repo
122- apt-get install -y --no-install-recommends gnupg ca-certificates wget && \
123- echo "deb https://repo.mysql.com/apt/debian/ bookworm mysql-8.0" >> /etc/apt/sources.list && \
124- # Fetch and install the MySQL public key
125- gpg --batch --keyserver hkp://keyserver.ubuntu.com --recv-keys A8D3785C && \
126- gpg --batch --armor --export A8D3785C | tee /etc/apt/trusted.gpg.d/mysql.asc && \
127- apt-get -q update ; \
118+ # First install gnupg and setup MySQL repo
119+ apt-get install -y --no-install-recommends gnupg ca-certificates wget && \
120+ echo "deb https://repo.mysql.com/apt/debian/ bookworm mysql-8.0" >> /etc/apt/sources.list && \
121+ # Fetch and install the MySQL public key
122+ gpg --batch --keyserver hkp://keyserver.ubuntu.com --recv-keys A8D3785C && \
123+ gpg --batch --armor --export A8D3785C | tee /etc/apt/trusted.gpg.d/mysql.asc && \
124+ apt-get -q update ; \
128125 fi && \
129126 POSTGRES_PKG="libpq5" && \
130- apt-get -q install -y --no-install-recommends $MYSQL_PKG $POSTGRES_PKG libssl3 libffi8 libcurl4 curl jq && \
127+ apt-get -q install -y --no-install-recommends $MYSQL_PKG $POSTGRES_PKG libssl3 libffi8 libcurl4 libpython3.11 python3 python3-pip python3-venv curl jq && \
128+ # The python3-cryptography debian package installs version 2.6.1, but we
129+ # we want to use the version specified in requirements.txt. To do this,
130+ # we have to remove the python3-cryptography package here.
131+ apt-get -q remove -y python3-cryptography 2>/dev/null || true && \
132+ apt-get -q autoremove -y && \
131133 rm -rf /var/lib/apt/lists/*
132134
133135WORKDIR /app
@@ -142,12 +144,11 @@ COPY --from=builder /app/wheels /tmp/wheels
142144RUN groupadd --gid 10001 app && \
143145 useradd --uid 10001 --gid 10001 --home /app --create-home app
144146
145- RUN pip3 install --break-system-packages --no-cache-dir "setuptools>=75.0.0" && \
146- pip3 install --break-system-packages --no-cache-dir --no-index --find-links=/tmp/wheels -r /app/requirements.txt && \
147+ RUN pip3 install --break-system-packages --no-cache-dir --no-index --find-links=/tmp/wheels -r /app/requirements.txt && \
147148 pip3 install --break-system-packages --no-cache-dir --no-index --find-links=/tmp/wheels -r /app/tools/integration_tests/requirements.txt && \
148149 pip3 install --break-system-packages --no-cache-dir --no-index --find-links=/tmp/wheels -r /app/tools/tokenserver/requirements.txt && \
149150 if [ "$SYNCSTORAGE_DATABASE_BACKEND" = "postgres" ] && [ -f /app/tools/postgres/requirements.txt ]; then \
150- pip3 install --break-system-packages --no-cache-dir --no-index --find-links=/tmp/wheels -r /app/tools/postgres/requirements.txt; \
151+ pip3 install --break-system-packages --no-cache-dir --no-index --find-links=/tmp/wheels -r /app/tools/postgres/requirements.txt; \
151152 fi && \
152153 rm -rf /tmp/wheels /root/.cache/pip
153154
0 commit comments