Dockerfile-workers 1.3 KB

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