2023-03-19 07:55:01 +01:00
|
|
|
FROM buildpack-deps:bullseye
|
|
|
|
|
|
|
|
ARG SRV_UID="1000"
|
|
|
|
ARG SRV_GID="100"
|
2024-03-01 02:54:24 +01:00
|
|
|
ARG SRV_LOCALE="en_US"
|
2023-03-19 07:55:01 +01:00
|
|
|
ARG SRV_VERSION="0"
|
|
|
|
|
2025-06-04 04:38:16 +02:00
|
|
|
ENV SRV_UID=$SRV_UID
|
|
|
|
ENV SRV_GID=$SRV_GID
|
|
|
|
ENV SRV_LOCALE=$SRV_LOCALE
|
|
|
|
ENV SRV_VERSION=$SRV_VERSION
|
|
|
|
ENV SRV_APT_GET_INSTALL=$SRV_APT_GET_INSTALL
|
2023-03-19 07:55:01 +01:00
|
|
|
|
2025-06-04 04:38:16 +02:00
|
|
|
ENV DEBIAN_FRONTEND="noninteractive"
|
|
|
|
ENV PGDATA="/data"
|
|
|
|
ENV POSTGRES_INITDB_ARGS="--locale=${SRV_LOCALE}.UTF-8 --lc-ctype=${SRV_LOCALE}.UTF-8 --lc-monetary=${SRV_LOCALE}.UTF-8 --lc-numeric=${SRV_LOCALE}.UTF-8 --lc-time=${SRV_LOCALE}.UTF-8 --lc-collate=${SRV_LOCALE}.UTF-8 --encoding=UTF8"
|
2023-03-19 07:55:01 +01:00
|
|
|
|
|
|
|
# explicitly set user/group IDs
|
|
|
|
RUN if [ -z "$( getent group $SRV_GID )" ] ; then groupadd -r postgres --gid=$SRV_GID ; fi && \
|
|
|
|
useradd -r -g $SRV_GID --uid=$SRV_UID --home-dir=/var/lib/postgresql --shell=/bin/bash postgres && \
|
2023-05-07 03:46:33 +02:00
|
|
|
mkdir -p $PGDATA && chown -R $SRV_UID:$SRV_GID $PGDATA && \
|
2024-03-01 02:54:24 +01:00
|
|
|
apt-get update -y && apt-get install -y apt-utils lsb-release && \
|
2023-03-19 07:55:01 +01:00
|
|
|
( curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg ) && \
|
|
|
|
( echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list ) && \
|
|
|
|
apt-get update -y && mkdir -p /docker-entrypoint-initdb.d && \
|
2024-03-01 02:54:24 +01:00
|
|
|
apt-get install -y postgresql-16 postgresql-common postgresql-16-pglogical \
|
|
|
|
postgresql-16-cron postgresql-16-extra-window-functions \
|
|
|
|
postgresql-16-first-last-agg postgresql-16-jsquery postgresql-16-numeral \
|
|
|
|
postgresql-16-pglogical-ticker postgresql-16-pgmemcache \
|
|
|
|
postgresql-16-pgpcre postgresql-16-pgrouting postgresql-16-repack \
|
|
|
|
postgresql-16-pgrouting-scripts postgresql-16-pgsphere \
|
|
|
|
postgresql-16-postgis-3 postgresql-16-postgis-3-scripts \
|
|
|
|
postgresql-16-repack postgresql-16-set-user postgresql-16-similarity \
|
|
|
|
postgresql-16-pgpool2 postgresql-16-semver postgresql-16-repmgr \
|
2024-08-17 01:16:42 +02:00
|
|
|
postgresql-plperl-16 postgresql-plpython3-16 postgresql-16-age \
|
|
|
|
postgresql-16-pgvector postgresql-16-tablelog postgresql-16-wal2json \
|
|
|
|
apgdiff locales-all $SRV_APT_GET_INSTALL && \
|
2023-05-07 05:21:25 +02:00
|
|
|
apt-get clean && rm -rf ~/.cache && rm -rf /var/lib/apt/lists/*
|
2023-03-19 22:37:29 +01:00
|
|
|
|
2024-03-01 02:54:24 +01:00
|
|
|
ENV PATH="/usr/lib/postgresql/16/bin:$PATH"
|
2023-03-19 07:55:01 +01:00
|
|
|
|
2024-03-01 02:54:24 +01:00
|
|
|
COPY docker-entrypoint.sh /
|
2023-03-19 07:55:01 +01:00
|
|
|
|
|
|
|
USER $SRV_UID:$SRV_GID
|
|
|
|
|
2023-05-07 03:46:33 +02:00
|
|
|
RUN ln -s $PGDATA/.bash_history $HOME/.bash_history
|
2023-03-19 07:55:01 +01:00
|
|
|
|
2023-05-07 03:46:33 +02:00
|
|
|
VOLUME $PGDATA
|
2023-03-19 07:55:01 +01:00
|
|
|
|
2023-05-07 03:46:33 +02:00
|
|
|
WORKDIR $PGDATA
|
2023-03-19 07:55:01 +01:00
|
|
|
|
2024-03-01 02:54:24 +01:00
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
2023-03-19 07:55:01 +01:00
|
|
|
|
|
|
|
STOPSIGNAL SIGINT
|
|
|
|
|
|
|
|
EXPOSE 5432
|
|
|
|
|
2024-03-31 00:44:36 +01:00
|
|
|
CMD ["postgres","-c","listen_addresses=*"]
|
2023-03-19 07:55:01 +01:00
|
|
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --retries=4 \
|
2024-12-16 00:19:02 +01:00
|
|
|
CMD pg_isready -U "${POSTGRES_USER:-postgres}"
|