Skip to content

Commit 7d457e7

Browse files
committed
revert attempts to inject python image, revisit due to pyramid upgrade necessity
1 parent 2b33bea commit 7d457e7

7 files changed

Lines changed: 42 additions & 44 deletions

File tree

Dockerfile

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ ARG TOKENSERVER_DATABASE_BACKEND=mysql
33
# Alternatively MYSQLCLIENT_PKG=libmysqlclient-dev for the Oracle/MySQL official client
44
ARG 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
98
FROM docker.io/lukemathwalker/cargo-chef:0.1.73-rust-1.91.1-bookworm AS chef
109
WORKDIR /app
1110

@@ -18,28 +17,26 @@ ARG SYNCSTORAGE_DATABASE_BACKEND
1817
ARG TOKENSERVER_DATABASE_BACKEND
1918
ARG MYSQLCLIENT_PKG
2019

21-
COPY --from=python-base /usr/local /usr/local
22-
2320
RUN 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

4542
COPY --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

9693
ENV 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
111108
ARG SYNCSTORAGE_DATABASE_BACKEND
112109
ARG TOKENSERVER_DATABASE_BACKEND
113110
ARG 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

133135
WORKDIR /app
@@ -142,12 +144,11 @@ COPY --from=builder /app/wheels /tmp/wheels
142144
RUN 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

poetry.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ package-mode = false
1515
[tool.poetry.dependencies]
1616
cryptography = "^46.0.5"
1717
pyfxa = "^0.8.1"
18-
setuptools = ">=75.0.0"
1918
tokenlib = "^2.0.0"
2019

2120
[tool.poetry.group.tokenserver-unit-tests.dependencies]

tools/integration_tests/poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/integration_tests/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ psutil = "^7.0.0"
2323
pyjwt = "^2.10.1"
2424
pyramid = "^1.10.8"
2525
pyramid-hawkauth = "^2.0.0"
26-
setuptools = ">=75.0.0"
2726
pyfxa = "0.8.1"
2827
pytest = "^9.0.2"
2928
requests = "^2.32.4"

tools/tokenserver/poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/tokenserver/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ boto = "2.49.0"
1818
hawkauthlib = "2.0.0"
1919
mysqlclient = "2.1.1"
2020
pyramid = "^1.10.8"
21-
setuptools = ">=75.0.0"
2221
sqlalchemy = "^1.4.46"
2322
testfixtures = "^8.3.0"
2423
tokenlib = "2.0.0"

0 commit comments

Comments
 (0)