|
| 1 | +ARG SYNAPSE_PKG_VER="v1.142.1" |
| 2 | +ARG PYTHON_PKG_VER="3.13" |
| 3 | + |
| 4 | +# stage 1 : build pip |
| 5 | +FROM matrixdotorg/synapse:${SYNAPSE_PKG_VER} AS pipwheels |
| 6 | +RUN apt-get update \ |
| 7 | + && apt-get install -y --no-install-recommends \ |
| 8 | + git \ |
| 9 | + build-essential \ |
| 10 | + patch \ |
| 11 | + libpq-dev\ |
| 12 | + && rm -rf /var/cache/apt/* |
| 13 | +WORKDIR /wheels |
| 14 | +RUN pip install psycopg2 |
| 15 | +RUN pip wheel --no-cache-dir --wheel-dir /wheels \ |
| 16 | + git+https://github.com/matrix-org/synapse-s3-storage-provider.git@2dbba1020fe6fb84d79f1a23c925e508d9ba15e1 \ |
| 17 | + git+https://gitlab.com/zerodotfive/googlesamlhandler.git@cb239e5d98bbe00465945c49661a9ca9ca134328 |
| 18 | + |
| 19 | +# stage 2 : apply workers.patch |
| 20 | +FROM pipwheels as workers_patch |
| 21 | +ARG PYTHON_PKG_VER |
| 22 | +COPY workers.patch /tmp/workers.patch |
| 23 | +RUN patch $(ls /usr/local/lib/python$PYTHON_PKG_VER/site-packages/synapse/config/workers.py) \ |
| 24 | + < /tmp/workers.patch \ |
| 25 | + && rm /tmp/workers.patch |
| 26 | + |
| 27 | +# stage 3 : apply e2e_room_keys.patch |
| 28 | +FROM pipwheels as e2e_patch |
| 29 | +ARG PYTHON_PKG_VER |
| 30 | +COPY e2e_room_keys.patch /tmp/e2e_room_keys.patch |
| 31 | +RUN patch $(ls /usr/local/lib/python${PYTHON_PKG_VER}/site-packages/synapse/storage/databases/main/e2e_room_keys.py) \ |
| 32 | + < /tmp/e2e_room_keys.patch \ |
| 33 | + && rm /tmp/e2e_room_keys.patch |
| 34 | + |
| 35 | +# stage 4 : base version with workers names |
| 36 | +FROM matrixdotorg/synapse:$SYNAPSE_PKG_VER as main |
| 37 | +ARG PYTHON_PKG_VER |
| 38 | +RUN --mount=type=bind,from=pipwheels,source=/wheels,target=/wheels \ |
| 39 | + pip install --no-cache-dir /wheels/* |
| 40 | +COPY --from=workers_patch \ |
| 41 | + /usr/local/lib/python${PYTHON_PKG_VER}/site-packages/synapse/config/workers.py \ |
| 42 | + /usr/local/lib/python${PYTHON_PKG_VER}/site-packages/synapse/config/workers.py |
| 43 | + |
| 44 | +# stage 5 : base version with e2e_room_keys table optimization |
| 45 | +FROM main as e2e |
| 46 | +ARG PYTHON_PKG_VER |
| 47 | +COPY --from=e2e_patch \ |
| 48 | + /usr/local/lib/python${PYTHON_PKG_VER}/site-packages/synapse/storage/databases/main/e2e_room_keys.py \ |
| 49 | + /usr/local/lib/python${PYTHON_PKG_VER}/site-packages/synapse/storage/databases/main/e2e_room_keys.py |
0 commit comments