Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

63 lignes
2.8 KiB

  1. # syntax=docker/dockerfile:1
  2. # This dockerfile builds on top of 'docker/Dockerfile-workers' in matrix-org/synapse
  3. # by including a built-in postgres instance, as well as setting up the homeserver so
  4. # that it is ready for testing via Complement.
  5. #
  6. # Instructions for building this image from those it depends on is detailed in this guide:
  7. # https://github.com/matrix-org/synapse/blob/develop/docker/README-testing.md#testing-with-postgresql-and-single-or-multi-process-synapse
  8. ARG SYNAPSE_VERSION=latest
  9. # first of all, we create a base image with a postgres server and database,
  10. # which we can copy into the target image. For repeated rebuilds, this is
  11. # much faster than apt installing postgres each time.
  12. #
  13. # This trick only works because (a) the Synapse image happens to have all the
  14. # shared libraries that postgres wants, (b) we use a postgres image based on
  15. # the same debian version as Synapse's docker image (so the versions of the
  16. # shared libraries match).
  17. FROM postgres:13-bullseye AS postgres_base
  18. # initialise the database cluster in /var/lib/postgresql
  19. RUN gosu postgres initdb --locale=C --encoding=UTF-8 --auth-host password
  20. # Configure a password and create a database for Synapse
  21. RUN echo "ALTER USER postgres PASSWORD 'somesecret'" | gosu postgres postgres --single
  22. RUN echo "CREATE DATABASE synapse" | gosu postgres postgres --single
  23. # now build the final image, based on the Synapse image.
  24. FROM matrixdotorg/synapse-workers:$SYNAPSE_VERSION
  25. # copy the postgres installation over from the image we built above
  26. RUN adduser --system --uid 999 postgres --home /var/lib/postgresql
  27. COPY --from=postgres_base /var/lib/postgresql /var/lib/postgresql
  28. COPY --from=postgres_base /usr/lib/postgresql /usr/lib/postgresql
  29. COPY --from=postgres_base /usr/share/postgresql /usr/share/postgresql
  30. RUN mkdir /var/run/postgresql && chown postgres /var/run/postgresql
  31. ENV PATH="${PATH}:/usr/lib/postgresql/13/bin"
  32. ENV PGDATA=/var/lib/postgresql/data
  33. # Extend the shared homeserver config to disable rate-limiting,
  34. # set Complement's static shared secret, enable registration, amongst other
  35. # tweaks to get Synapse ready for testing.
  36. # To do this, we copy the old template out of the way and then include it
  37. # with Jinja2.
  38. RUN mv /conf/shared.yaml.j2 /conf/shared-orig.yaml.j2
  39. COPY conf/workers-shared-extra.yaml.j2 /conf/shared.yaml.j2
  40. WORKDIR /data
  41. COPY conf/postgres.supervisord.conf /etc/supervisor/conf.d/postgres.conf
  42. # Copy the entrypoint
  43. COPY conf/start_for_complement.sh /
  44. # Expose nginx's listener ports
  45. EXPOSE 8008 8448
  46. ENTRYPOINT ["/start_for_complement.sh"]
  47. # Update the healthcheck to have a shorter check interval
  48. HEALTHCHECK --start-period=5s --interval=1s --timeout=1s \
  49. CMD /bin/sh /healthcheck.sh