mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-13 22:03:31 +01:00
complement: init postgres DB directly inside the target image (#13819)
Doing so in the base postgres image doesn't work with buildah because changes in a declared VOLUME in the Dockerfile is supposed to be discarded, cf https://docs.docker.com/engine/reference/builder/#volume Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
This commit is contained in:
parent
74f60cec92
commit
384dca53d6
2 changed files with 12 additions and 13 deletions
1
changelog.d/13819.misc
Normal file
1
changelog.d/13819.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
complement: init postgres DB directly inside the target image instead of the base postgres image to fix building using Buildah.
|
|
@ -17,7 +17,17 @@ ARG SYNAPSE_VERSION=latest
|
||||||
# the same debian version as Synapse's docker image (so the versions of the
|
# the same debian version as Synapse's docker image (so the versions of the
|
||||||
# shared libraries match).
|
# shared libraries match).
|
||||||
|
|
||||||
FROM postgres:13-bullseye AS postgres_base
|
# now build the final image, based on the Synapse image.
|
||||||
|
|
||||||
|
FROM matrixdotorg/synapse-workers:$SYNAPSE_VERSION
|
||||||
|
# copy the postgres installation over from the image we built above
|
||||||
|
RUN adduser --system --uid 999 postgres --home /var/lib/postgresql
|
||||||
|
COPY --from=postgres:13-bullseye /usr/lib/postgresql /usr/lib/postgresql
|
||||||
|
COPY --from=postgres:13-bullseye /usr/share/postgresql /usr/share/postgresql
|
||||||
|
RUN mkdir /var/run/postgresql && chown postgres /var/run/postgresql
|
||||||
|
ENV PATH="${PATH}:/usr/lib/postgresql/13/bin"
|
||||||
|
ENV PGDATA=/var/lib/postgresql/data
|
||||||
|
|
||||||
# initialise the database cluster in /var/lib/postgresql
|
# initialise the database cluster in /var/lib/postgresql
|
||||||
RUN gosu postgres initdb --locale=C --encoding=UTF-8 --auth-host password
|
RUN gosu postgres initdb --locale=C --encoding=UTF-8 --auth-host password
|
||||||
|
|
||||||
|
@ -25,18 +35,6 @@ FROM postgres:13-bullseye AS postgres_base
|
||||||
RUN echo "ALTER USER postgres PASSWORD 'somesecret'" | gosu postgres postgres --single
|
RUN echo "ALTER USER postgres PASSWORD 'somesecret'" | gosu postgres postgres --single
|
||||||
RUN echo "CREATE DATABASE synapse" | gosu postgres postgres --single
|
RUN echo "CREATE DATABASE synapse" | gosu postgres postgres --single
|
||||||
|
|
||||||
# now build the final image, based on the Synapse image.
|
|
||||||
|
|
||||||
FROM matrixdotorg/synapse-workers:$SYNAPSE_VERSION
|
|
||||||
# copy the postgres installation over from the image we built above
|
|
||||||
RUN adduser --system --uid 999 postgres --home /var/lib/postgresql
|
|
||||||
COPY --from=postgres_base /var/lib/postgresql /var/lib/postgresql
|
|
||||||
COPY --from=postgres_base /usr/lib/postgresql /usr/lib/postgresql
|
|
||||||
COPY --from=postgres_base /usr/share/postgresql /usr/share/postgresql
|
|
||||||
RUN mkdir /var/run/postgresql && chown postgres /var/run/postgresql
|
|
||||||
ENV PATH="${PATH}:/usr/lib/postgresql/13/bin"
|
|
||||||
ENV PGDATA=/var/lib/postgresql/data
|
|
||||||
|
|
||||||
# Extend the shared homeserver config to disable rate-limiting,
|
# Extend the shared homeserver config to disable rate-limiting,
|
||||||
# set Complement's static shared secret, enable registration, amongst other
|
# set Complement's static shared secret, enable registration, amongst other
|
||||||
# tweaks to get Synapse ready for testing.
|
# tweaks to get Synapse ready for testing.
|
||||||
|
|
Loading…
Reference in a new issue