Dockerfile-workers 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Inherit from the official Synapse docker image
  2. ARG SYNAPSE_VERSION=latest
  3. FROM matrixdotorg/synapse:$SYNAPSE_VERSION
  4. # Install deps
  5. RUN \
  6. --mount=type=cache,target=/var/cache/apt,sharing=locked \
  7. --mount=type=cache,target=/var/lib/apt,sharing=locked \
  8. apt-get update && \
  9. DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
  10. redis-server nginx-light
  11. # Install supervisord with pip instead of apt, to avoid installing a second
  12. # copy of python.
  13. RUN --mount=type=cache,target=/root/.cache/pip \
  14. pip install supervisor~=4.2
  15. # Disable the default nginx sites
  16. RUN rm /etc/nginx/sites-enabled/default
  17. # Copy Synapse worker, nginx and supervisord configuration template files
  18. COPY ./docker/conf-workers/* /conf/
  19. # Copy a script to prefix log lines with the supervisor program name
  20. COPY ./docker/prefix-log /usr/local/bin/
  21. # Expose nginx listener port
  22. EXPOSE 8080/tcp
  23. # A script to read environment variables and create the necessary
  24. # files to run the desired worker configuration. Will start supervisord.
  25. COPY ./docker/configure_workers_and_start.py /configure_workers_and_start.py
  26. ENTRYPOINT ["/configure_workers_and_start.py"]
  27. # Replace the healthcheck with one which checks *all* the workers. The script
  28. # is generated by configure_workers_and_start.py.
  29. HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \
  30. CMD /bin/sh /healthcheck.sh