Dockerfile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. ARG PYTHON_VERSION=2
  2. ###
  3. ### Stage 0: builder
  4. ###
  5. FROM docker.io/python:${PYTHON_VERSION}-alpine3.8 as builder
  6. # install the OS build deps
  7. RUN apk add \
  8. build-base \
  9. libffi-dev \
  10. libjpeg-turbo-dev \
  11. libressl-dev \
  12. libxslt-dev \
  13. linux-headers \
  14. postgresql-dev \
  15. zlib-dev
  16. # build things which have slow build steps, before we copy synapse, so that
  17. # the layer can be cached.
  18. #
  19. # (we really just care about caching a wheel here, as the "pip install" below
  20. # will install them again.)
  21. RUN pip install --prefix="/install" --no-warn-script-location \
  22. cryptography \
  23. msgpack-python \
  24. pillow \
  25. pynacl
  26. # now install synapse and all of the python deps to /install.
  27. COPY . /synapse
  28. RUN pip install --prefix="/install" --no-warn-script-location \
  29. /synapse[all]
  30. ###
  31. ### Stage 1: runtime
  32. ###
  33. FROM docker.io/python:${PYTHON_VERSION}-alpine3.8
  34. RUN apk add --no-cache --virtual .runtime_deps \
  35. libffi \
  36. libjpeg-turbo \
  37. libressl \
  38. libxslt \
  39. libpq \
  40. zlib \
  41. su-exec
  42. COPY --from=builder /install /usr/local
  43. COPY ./docker/start.py /start.py
  44. COPY ./docker/conf /conf
  45. VOLUME ["/data"]
  46. EXPOSE 8008/tcp 8448/tcp
  47. ENTRYPOINT ["/start.py"]