Dockerfile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # Dockerfile to build the matrixdotorg/synapse docker images.
  2. #
  3. # To build the image, run `docker build` command from the root of the
  4. # synapse repository:
  5. #
  6. # docker build -f docker/Dockerfile .
  7. #
  8. # There is an optional PYTHON_VERSION build argument which sets the
  9. # version of python to build against: for example:
  10. #
  11. # docker build -f docker/Dockerfile --build-arg PYTHON_VERSION=3.6 .
  12. #
  13. ARG PYTHON_VERSION=3.7
  14. ###
  15. ### Stage 0: builder
  16. ###
  17. FROM docker.io/python:${PYTHON_VERSION}-slim as builder
  18. # install the OS build deps
  19. RUN apt-get update && apt-get install -y \
  20. build-essential \
  21. libpq-dev \
  22. && rm -rf /var/lib/apt/lists/*
  23. # Build dependencies that are not available as wheels, to speed up rebuilds
  24. RUN pip install --prefix="/install" --no-warn-script-location \
  25. frozendict \
  26. jaeger-client \
  27. opentracing \
  28. prometheus-client \
  29. psycopg2 \
  30. pycparser \
  31. pyrsistent \
  32. pyyaml \
  33. simplejson \
  34. threadloop \
  35. thrift
  36. # now install synapse and all of the python deps to /install.
  37. COPY synapse /synapse/synapse/
  38. COPY scripts /synapse/scripts/
  39. COPY MANIFEST.in README.rst setup.py synctl /synapse/
  40. RUN pip install --prefix="/install" --no-warn-script-location \
  41. /synapse[all]
  42. ###
  43. ### Stage 1: runtime
  44. ###
  45. FROM docker.io/python:${PYTHON_VERSION}-slim
  46. RUN apt-get update && apt-get install -y \
  47. libpq5 \
  48. xmlsec1 \
  49. gosu \
  50. && rm -rf /var/lib/apt/lists/*
  51. COPY --from=builder /install /usr/local
  52. COPY ./docker/start.py /start.py
  53. COPY ./docker/conf /conf
  54. VOLUME ["/data"]
  55. EXPOSE 8008/tcp 8009/tcp 8448/tcp
  56. ENTRYPOINT ["/start.py"]