@@ -40,7 +40,7 @@ RUN apk add -uU --no-cache \
4040 su-exec \
4141 openssl \
4242 krb5 \
43- postgresql -client \
43+ postgresql17 -client \
4444 perl
4545
4646# Copy pgBadger
@@ -60,25 +60,26 @@ RUN mkdir -p /var/lib/postgresql/data \
6060
6161WORKDIR /app
6262# making sure we use the binaries from the installed postgresql17 client
63- ENV PG_DUMP_BINARY=/usr/local/pgsql/ bin/pg_dump
64- ENV PG_RESTORE_BINARY=/usr/local/pgsql/ bin/pg_restore
63+ ENV PG_DUMP_BINARY=/usr/bin/pg_dump
64+ ENV PG_RESTORE_BINARY=/usr/bin/pg_restore
6565ENV PATH="/usr/local/pgsql/bin:$PATH"
6666ENV PGDATA=/var/lib/postgresql/data
6767
6868RUN sed -i 's|nobody:/|nobody:/home|' /etc/passwd && chown nobody:nobody /home
6969
7070ENV POSTGRES_URL=postgresql://postgres@localhost/postgres?host=/tmp
7171
72- RUN su-exec postgres initdb -D $PGDATA || true && \
73- # echo "shared_preload_libraries = 'timescaledb,pg_stat_statements'" >> $PGDATA/postgresql.conf && \
74- echo "listen_addresses = ''" >> $PGDATA/postgresql.conf && \
75- echo "unix_socket_directories = '/tmp'" >> $PGDATA/postgresql.conf
72+ COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
73+ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
74+
7675
7776USER postgres
7877
78+ RUN initdb -D "$PGDATA"
79+
80+ # We don't expose 5432 because
81+ # 1. We use a unix socket
82+ # 2. The external user should never have to interface with the internal postgres service
7983EXPOSE 2345
8084
81- CMD ["/bin/bash" , "-c" , "\
82- pg_ctl -D $PGDATA -l $PGDATA/logfile start || (cat $PGDATA/logfile && exit 1) && \
83- until pg_isready -h /tmp; do sleep 0.5; done && \
84- node /app/dist/main.mjs" ]
85+ ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh" ]
0 commit comments