1
0

Dockerfile 2.0 KB

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