1- # syntax=docker/dockerfile:1
1+ # syntax=docker/dockerfile:1-labs
22
33ARG SYNAPSE_VERSION=latest
44ARG FROM=matrixdotorg/synapse:$SYNAPSE_VERSION
5- ARG DEBIAN_VERSION=bookworm
6- ARG PYTHON_VERSION=3.12
5+ ARG DEBIAN_VERSION=trixie
6+ ARG PYTHON_VERSION=3.13
7+ ARG REDIS_VERSION=7.2
78
89# first of all, we create a base image with dependencies which we can copy into the
910# target image. For repeated rebuilds, this is much faster than apt installing
1011# each time.
1112
1213FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-${DEBIAN_VERSION} AS deps_base
1314
15+ ARG DEBIAN_VERSION
16+ ARG REDIS_VERSION
17+
1418 # Tell apt to keep downloaded package files, as we're using cache mounts.
1519 RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
1620
21+ # The upstream redis-server deb has fewer dynamic libraries than Debian's package which makes it easier to copy later on
22+ RUN \
23+ curl -fsSL https://packages.redis.io/gpg | gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg && \
24+ chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg && \
25+ echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb ${DEBIAN_VERSION} main" | tee /etc/apt/sources.list.d/redis.list
26+
1727 RUN \
1828 --mount=type=cache,target=/var/cache/apt,sharing=locked \
1929 --mount=type=cache,target=/var/lib/apt,sharing=locked \
2030 apt-get update -qq && \
2131 DEBIAN_FRONTEND=noninteractive apt-get install -yqq --no-install-recommends \
22- nginx-light
32+ nginx-light \
33+ redis-server="6:${REDIS_VERSION}.*" redis-tools="6:${REDIS_VERSION}.*" \
34+ # libicu is required by postgres, see `docker/complement/Dockerfile`
35+ libicu76
2336
2437 RUN \
2538 # remove default page
@@ -35,19 +48,12 @@ FROM ghcr.io/astral-sh/uv:python${PYTHON_VERSION}-${DEBIAN_VERSION} AS deps_base
3548
3649 RUN mkdir -p /uv/etc/supervisor/conf.d
3750
38- # Similarly, a base to copy the redis server from.
39- #
40- # The redis docker image has fewer dynamic libraries than the debian package,
41- # which makes it much easier to copy (but we need to make sure we use an image
42- # based on the same debian version as the synapse image, to make sure we get
43- # the expected version of libc.
44- FROM docker.io/library/redis:7-${DEBIAN_VERSION} AS redis_base
45-
4651# now build the final image, based on the the regular Synapse docker image
4752FROM $FROM
4853
4954 # Copy over dependencies
50- COPY --from=redis_base /usr/local/bin/redis-server /usr/local/bin
55+ COPY --from=deps_base --parents /usr/lib/*-linux-gnu/libicu* /
56+ COPY --from=deps_base /usr/bin/redis-server /usr/local/bin
5157 COPY --from=deps_base /uv /
5258 COPY --from=deps_base /usr/sbin/nginx /usr/sbin
5359 COPY --from=deps_base /usr/share/nginx /usr/share/nginx
0 commit comments