Dockerfile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # This dockerfile builds on top of 'docker/Dockerfile-workers' in matrix-org/synapse
  2. # by including a built-in postgres instance, as well as setting up the homeserver so
  3. # that it is ready for testing via Complement.
  4. #
  5. # Instructions for building this image from those it depends on is detailed in this guide:
  6. # https://github.com/matrix-org/synapse/blob/develop/docker/README-testing.md#testing-with-postgresql-and-single-or-multi-process-synapse
  7. ARG SYNAPSE_VERSION=latest
  8. FROM matrixdotorg/synapse-workers:$SYNAPSE_VERSION
  9. # Install postgresql
  10. RUN apt-get update && \
  11. DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y postgresql-13
  12. # Configure a user and create a database for Synapse
  13. RUN pg_ctlcluster 13 main start && su postgres -c "echo \
  14. \"ALTER USER postgres PASSWORD 'somesecret'; \
  15. CREATE DATABASE synapse \
  16. ENCODING 'UTF8' \
  17. LC_COLLATE='C' \
  18. LC_CTYPE='C' \
  19. template=template0;\" | psql" && pg_ctlcluster 13 main stop
  20. # Extend the shared homeserver config to disable rate-limiting,
  21. # set Complement's static shared secret, enable registration, amongst other
  22. # tweaks to get Synapse ready for testing.
  23. # To do this, we copy the old template out of the way and then include it
  24. # with Jinja2.
  25. RUN mv /conf/shared.yaml.j2 /conf/shared-orig.yaml.j2
  26. COPY conf/workers-shared-extra.yaml.j2 /conf/shared.yaml.j2
  27. WORKDIR /data
  28. COPY conf/postgres.supervisord.conf /etc/supervisor/conf.d/postgres.conf
  29. # Copy the entrypoint
  30. COPY conf/start_for_complement.sh /
  31. # Expose nginx's listener ports
  32. EXPOSE 8008 8448
  33. ENTRYPOINT ["/start_for_complement.sh"]
  34. # Update the healthcheck to have a shorter check interval
  35. HEALTHCHECK --start-period=5s --interval=1s --timeout=1s \
  36. CMD /bin/sh /healthcheck.sh