@@ -25,42 +25,40 @@ LABEL org.opencontainers.image.licenses='Apache-2.0'
2525
2626# install the OS build deps
2727RUN apt-get update && apt-get install -y \
28- build-essential \
29- libffi-dev \
30- libjpeg-dev \
31- libpq-dev \
32- libssl-dev \
33- libwebp-dev \
34- libxml++2.6-dev \
35- libxslt1-dev \
36- openssl \
37- rustc \
38- zlib1g-dev \
39- && rm -rf /var/lib/apt/lists/*
40-
41- # Build dependencies that are not available as wheels, to speed up rebuilds
42- RUN pip install --prefix="/install" --no-warn-script-location \
43- cryptography \
44- frozendict \
45- jaeger-client \
46- opentracing \
47- # Match the version constraints of Synapse
48- "prometheus_client>=0.4.0" \
49- psycopg2 \
50- pycparser \
51- pyrsistent \
52- pyyaml \
53- simplejson \
54- threadloop \
55- thrift
56-
57- # now install synapse and all of the python deps to /install.
58- COPY synapse /synapse/synapse/
28+ build-essential \
29+ libffi-dev \
30+ libjpeg-dev \
31+ libpq-dev \
32+ libssl-dev \
33+ libwebp-dev \
34+ libxml++2.6-dev \
35+ libxslt1-dev \
36+ openssl \
37+ rustc \
38+ zlib1g-dev \
39+ && rm -rf /var/lib/apt/lists/*
40+
41+ # Copy just what we need to pip install
5942COPY scripts /synapse/scripts/
6043COPY MANIFEST.in README.rst setup.py synctl /synapse/
44+ COPY synapse/__init__.py /synapse/synapse/__init__.py
45+ COPY synapse/python_dependencies.py /synapse/synapse/python_dependencies.py
6146
47+ # To speed up rebuilds, install all of the dependencies before we copy over
48+ # the whole synapse project so that we this layer in the Docker cache can be
49+ # used while you develop on the source
50+ #
51+ # This is aiming at installing the `install_requires` and `extras_require` from `setup.py`
6252RUN pip install --prefix="/install" --no-warn-script-location \
63- /synapse[all]
53+ /synapse[all]
54+
55+ # Copy over the rest of the project
56+ COPY synapse /synapse/synapse/
57+
58+ # Install the synapse package itself and all of its children packages.
59+ #
60+ # This is aiming at installing only the `packages=find_packages(...)` from `setup.py
61+ RUN pip install --prefix="/install" --no-deps --no-warn-script-location /synapse
6462
6563# ##
6664# ## Stage 1: runtime
@@ -69,16 +67,16 @@ RUN pip install --prefix="/install" --no-warn-script-location \
6967FROM docker.io/python:${PYTHON_VERSION}-slim
7068
7169RUN apt-get update && apt-get install -y \
72- curl \
73- gosu \
74- libjpeg62-turbo \
75- libpq5 \
76- libwebp6 \
77- xmlsec1 \
78- libjemalloc2 \
79- libssl-dev \
80- openssl \
81- && rm -rf /var/lib/apt/lists/*
70+ curl \
71+ gosu \
72+ libjpeg62-turbo \
73+ libpq5 \
74+ libwebp6 \
75+ xmlsec1 \
76+ libjemalloc2 \
77+ libssl-dev \
78+ openssl \
79+ && rm -rf /var/lib/apt/lists/*
8280
8381COPY --from=builder /install /usr/local
8482COPY ./docker/start.py /start.py
@@ -91,4 +89,4 @@ EXPOSE 8008/tcp 8009/tcp 8448/tcp
9189ENTRYPOINT ["/start.py" ]
9290
9391HEALTHCHECK --interval=1m --timeout=5s \
94- CMD curl -fSs http://localhost:8008/health || exit 1
92+ CMD curl -fSs http://localhost:8008/health || exit 1
0 commit comments