25
25
# https://stackoverflow.com/questions/53835198/integrating-python-poetry-with-docker?answertab=scoredesc
26
26
27
27
28
- ARG PYTHON_VERSION=3.9
28
+ ARG PYTHON_VERSION=3.11
29
29
ARG BASE_IMAGE=docker.io/python:${PYTHON_VERSION}-slim-bullseye
30
30
31
-
32
31
# ##
33
32
# ## Stage 0: generate requirements.txt
34
33
# ##
@@ -41,11 +40,11 @@ FROM $BASE_IMAGE as requirements
41
40
# Here we use it to set up a cache for apt (and below for pip), to improve
42
41
# rebuild speeds on slow connections.
43
42
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/*
49
48
50
49
# Install rust and ensure its in the PATH
51
50
ENV RUSTUP_HOME=/rust
@@ -79,9 +78,9 @@ ARG TEST_ONLY_IGNORE_POETRY_LOCKFILE
79
78
# Otherwise, just create an empty requirements file so that the Dockerfile can
80
79
# proceed.
81
80
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}; \
83
82
else \
84
- touch /synapse/requirements.txt; \
83
+ touch /synapse/requirements.txt; \
85
84
fi
86
85
87
86
# ##
@@ -91,25 +90,24 @@ FROM $BASE_IMAGE as builder
91
90
92
91
# install the OS build deps
93
92
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/*
113
111
114
112
# Install rust and ensure its in the PATH
115
113
ENV RUSTUP_HOME=/rust
@@ -161,9 +159,9 @@ ARG TEST_ONLY_IGNORE_POETRY_LOCKFILE
161
159
RUN --mount=type=cache,target=/synapse/target,sharing=locked \
162
160
--mount=type=cache,target=${CARGO_HOME}/registry,sharing=locked \
163
161
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]; \
165
163
else \
166
- pip install --prefix="/install" --no-warn-script-location /synapse[all]; \
164
+ pip install --prefix="/install" --no-warn-script-location /synapse[all]; \
167
165
fi
168
166
169
167
# Beeper: pyston fixes
@@ -185,20 +183,20 @@ LABEL org.opencontainers.image.source='https://github.com/matrix-org/synapse.git
185
183
LABEL org.opencontainers.image.licenses='Apache-2.0'
186
184
187
185
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 \
190
188
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/*
202
200
203
201
COPY --from=builder /install/bin /usr/local/bin
204
202
# 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
214
212
ENTRYPOINT ["/start.py" ]
215
213
216
214
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