From 2addc93c7bed9c9378a6976dd244f75c7ab4fa3c Mon Sep 17 00:00:00 2001 From: Matt Avery Date: Tue, 24 Jun 2025 23:01:33 -0400 Subject: [PATCH] workflow --- Dockerfile | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e3f36d0..9373d1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,5 +18,35 @@ RUN set -ex \ RUN wal-g --help RUN ls -la /usr/local/bin/wal-g* -FROM alpine:3 -COPY --from=builder /usr/local/bin/wal-g /usr/local/bin/wal-g \ No newline at end of file +FROM postgres:alpine +COPY --from=builder /usr/local/bin/wal-g /usr/local/bin/wal-g + +RUN mkdir -p /etc/postgresql/ \ + && cp /usr/local/share/postgresql/postgresql.conf.sample /etc/postgresql/postgresql.conf.tmpl \ + && sed -ri "s/^#archive_mode = off/archive_mode = {{.Env.ARCHIVE_MODE}}/" /etc/postgresql/postgresql.conf.tmpl \ + && sed -ri "s/^#archive_timeout = 0/archive_timeout = {{.Env.ARCHIVE_TIMEOUT}}/" /etc/postgresql/postgresql.conf.tmpl \ + && sed -ri "s/^#archive_command = ''/archive_command = '\/wal-g wal-push %p'/" /etc/postgresql/postgresql.conf.tmpl \ + && sed -ri "s/^#restore_command = ''/restore_command = '\/wal-g wal-fetch %f %p'/" /etc/postgresql/postgresql.conf.tmpl + +ADD docker-entrypoint.sh /docker-entrypoint.sh +RUN chmod u+x /docker-entrypoint.sh +ENTRYPOINT ["/docker-entrypoint.sh"] + +# See environment variables documentation https://github.com/wal-g/wal-g#configuration +#ENV WALE_S3_PREFIX=s3://bucket/path/to/folder +#ENV AWS_ACCESS_KEY_ID=xxxx +#ENV AWS_SECRET_ACCESS_KEY=secret +#ENV AWS_REGION=us-west-2 +#ENV AWS_ENDPOINT=http://s3-like-service:9000 +ENV AWS_S3_FORCE_PATH_STYLE=true +ENV WALG_COMPRESSION_METHOD brotli + +# See environment variables documentation https://github.com/wal-g/wal-g/blob/master/PostgreSQL.md#configuration +ENV PGHOST=/var/run/postgresql +ENV PGUSER=postgres +#ENV PGPASSWORD=secret +ENV ARCHIVE_MODE=off +ENV ARCHIVE_TIMEOUT=0 +#ENV WALG_PGP_KEY_PATH=/keys/wal-g.pub + +CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"] \ No newline at end of file