Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit 8774e80

Browse files
iakatFizzadar
authored andcommitted
Dockerfile: Bump Python version from 3.9 to 3.11 (matrix-org#14875)
Closes matrix-org#13234 Signed-off-by: Katia Esposito <[email protected]> Signed-off-by: Katia Esposito <[email protected]> # Conflicts: # docker/Dockerfile
1 parent 824f252 commit 8774e80

File tree

2 files changed

+43
-44
lines changed

2 files changed

+43
-44
lines changed

changelog.d/14875.docker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bump default Python version in the Dockerfile from 3.9 to 3.11.

docker/Dockerfile

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
# https://stackoverflow.com/questions/53835198/integrating-python-poetry-with-docker?answertab=scoredesc
2626

2727

28-
ARG PYTHON_VERSION=3.9
28+
ARG PYTHON_VERSION=3.11
2929
ARG BASE_IMAGE=docker.io/python:${PYTHON_VERSION}-slim-bullseye
3030

31-
3231
###
3332
### Stage 0: generate requirements.txt
3433
###
@@ -41,11 +40,11 @@ FROM $BASE_IMAGE as requirements
4140
# Here we use it to set up a cache for apt (and below for pip), to improve
4241
# rebuild speeds on slow connections.
4342
RUN \
44-
--mount=type=cache,target=/var/cache/apt,sharing=locked \
45-
--mount=type=cache,target=/var/lib/apt,sharing=locked \
46-
apt-get update -qq && apt-get install -yqq \
47-
build-essential git libffi-dev libssl-dev curl \
48-
&& rm -rf /var/lib/apt/lists/*
43+
--mount=type=cache,target=/var/cache/apt,sharing=locked \
44+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
45+
apt-get update -qq && apt-get install -yqq \
46+
build-essential git libffi-dev libssl-dev \
47+
&& rm -rf /var/lib/apt/lists/*
4948

5049
# Install rust and ensure its in the PATH
5150
ENV RUSTUP_HOME=/rust
@@ -79,9 +78,9 @@ ARG TEST_ONLY_IGNORE_POETRY_LOCKFILE
7978
# Otherwise, just create an empty requirements file so that the Dockerfile can
8079
# proceed.
8180
RUN if [ -z "$TEST_ONLY_IGNORE_POETRY_LOCKFILE" ]; then \
82-
/root/.local/bin/poetry export --extras all -o /synapse/requirements.txt ${TEST_ONLY_SKIP_DEP_HASH_VERIFICATION:+--without-hashes}; \
81+
/root/.local/bin/poetry export --extras all -o /synapse/requirements.txt ${TEST_ONLY_SKIP_DEP_HASH_VERIFICATION:+--without-hashes}; \
8382
else \
84-
touch /synapse/requirements.txt; \
83+
touch /synapse/requirements.txt; \
8584
fi
8685

8786
###
@@ -91,25 +90,24 @@ FROM $BASE_IMAGE as builder
9190

9291
# install the OS build deps
9392
RUN \
94-
--mount=type=cache,target=/var/cache/apt,sharing=locked \
95-
--mount=type=cache,target=/var/lib/apt,sharing=locked \
96-
apt-get update -qq && apt-get install -yqq \
97-
git \
98-
build-essential \
99-
libffi-dev \
100-
libjpeg-dev \
101-
libpq-dev \
102-
libssl-dev \
103-
libwebp-dev \
104-
libxml++2.6-dev \
105-
libxslt1-dev \
106-
openssl \
107-
zlib1g-dev \
108-
git \
109-
curl \
110-
libicu-dev \
111-
pkg-config \
112-
&& rm -rf /var/lib/apt/lists/*
93+
--mount=type=cache,target=/var/cache/apt,sharing=locked \
94+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
95+
apt-get update -qq && apt-get install -yqq \
96+
build-essential \
97+
libffi-dev \
98+
libjpeg-dev \
99+
libpq-dev \
100+
libssl-dev \
101+
libwebp-dev \
102+
libxml++2.6-dev \
103+
libxslt1-dev \
104+
openssl \
105+
zlib1g-dev \
106+
git \
107+
curl \
108+
libicu-dev \
109+
pkg-config \
110+
&& rm -rf /var/lib/apt/lists/*
113111

114112
# Install rust and ensure its in the PATH
115113
ENV RUSTUP_HOME=/rust
@@ -161,9 +159,9 @@ ARG TEST_ONLY_IGNORE_POETRY_LOCKFILE
161159
RUN --mount=type=cache,target=/synapse/target,sharing=locked \
162160
--mount=type=cache,target=${CARGO_HOME}/registry,sharing=locked \
163161
if [ -z "$TEST_ONLY_IGNORE_POETRY_LOCKFILE" ]; then \
164-
pip install --prefix="/install" --no-deps --no-warn-script-location /synapse[all]; \
162+
pip install --prefix="/install" --no-deps --no-warn-script-location /synapse[all]; \
165163
else \
166-
pip install --prefix="/install" --no-warn-script-location /synapse[all]; \
164+
pip install --prefix="/install" --no-warn-script-location /synapse[all]; \
167165
fi
168166

169167
# Beeper: pyston fixes
@@ -185,20 +183,20 @@ LABEL org.opencontainers.image.source='https://github.com/matrix-org/synapse.git
185183
LABEL org.opencontainers.image.licenses='Apache-2.0'
186184

187185
RUN \
188-
--mount=type=cache,target=/var/cache/apt,sharing=locked \
189-
--mount=type=cache,target=/var/lib/apt,sharing=locked \
186+
--mount=type=cache,target=/var/cache/apt,sharing=locked \
187+
--mount=type=cache,target=/var/lib/apt,sharing=locked \
190188
apt-get update -qq && apt-get install -yqq \
191-
curl \
192-
gosu \
193-
libjpeg62-turbo \
194-
libpq5 \
195-
libwebp6 \
196-
xmlsec1 \
197-
libjemalloc2 \
198-
libicu67 \
199-
libssl-dev \
200-
openssl \
201-
&& rm -rf /var/lib/apt/lists/*
189+
curl \
190+
gosu \
191+
libjpeg62-turbo \
192+
libpq5 \
193+
libwebp6 \
194+
xmlsec1 \
195+
libjemalloc2 \
196+
libicu67 \
197+
libssl-dev \
198+
openssl \
199+
&& rm -rf /var/lib/apt/lists/*
202200

203201
COPY --from=builder /install/bin /usr/local/bin
204202
# Copy the python site-packages into /install instead of /usr/local/lib as some environments use different paths
@@ -214,4 +212,4 @@ EXPOSE 8008/tcp 8009/tcp 8448/tcp
214212
ENTRYPOINT ["/start.py"]
215213

216214
HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \
217-
CMD curl -fSs http://localhost:8008/health || exit 1
215+
CMD curl -fSs http://localhost:8008/health || exit 1

0 commit comments

Comments
 (0)