Dockerfile 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. libffi-dev \
  22. libjpeg-dev \
  23. libpq-dev \
  24. libssl-dev \
  25. libwebp-dev \
  26. libxml++2.6-dev \
  27. libxslt1-dev \
  28. zlib1g-dev \
  29. && rm -rf /var/lib/apt/lists/*
  30. # Build dependencies that are not available as wheels, to speed up rebuilds
  31. RUN pip install --prefix="/install" --no-warn-script-location \
  32. frozendict \
  33. jaeger-client \
  34. opentracing \
  35. prometheus-client \
  36. psycopg2 \
  37. pycparser \
  38. pyrsistent \
  39. pyyaml \
  40. simplejson \
  41. threadloop \
  42. thrift
  43. # now install synapse and all of the python deps to /install.
  44. COPY synapse /synapse/synapse/
  45. COPY scripts /synapse/scripts/
  46. COPY MANIFEST.in README.rst setup.py synctl /synapse/
  47. RUN pip install --prefix="/install" --no-warn-script-location \
  48. /synapse[all]
  49. ###
  50. ### Stage 1: runtime
  51. ###
  52. FROM docker.io/python:${PYTHON_VERSION}-slim
  53. RUN apt-get update && apt-get install -y \
  54. curl \
  55. gosu \
  56. libjpeg62-turbo \
  57. libpq5 \
  58. libwebp6 \
  59. xmlsec1 \
  60. && rm -rf /var/lib/apt/lists/*
  61. COPY --from=builder /install /usr/local
  62. COPY ./docker/start.py /start.py
  63. COPY ./docker/conf /conf
  64. VOLUME ["/data"]
  65. EXPOSE 8008/tcp 8009/tcp 8448/tcp
  66. ENTRYPOINT ["/start.py"]
  67. HEALTHCHECK --interval=1m --timeout=5s \
  68. CMD curl -fSs http://localhost:8008/health || exit 1