62 lines
2.5 KiB
Docker
62 lines
2.5 KiB
Docker
FROM buildpack-deps:bookworm
|
|
|
|
ARG SRV_UID="1000"
|
|
ARG SRV_GID="100"
|
|
ARG SRV_LOCALE="en_US"
|
|
ARG SRV_VERSION="0"
|
|
ARG SRV_APT_GET_INSTALL=""
|
|
|
|
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
|
|
|
|
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"
|
|
|
|
# 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 && \
|
|
mkdir -p $PGDATA && chown -R $SRV_UID:$SRV_GID $PGDATA && \
|
|
apt-get update -y && apt-get install -y apt-utils lsb-release && \
|
|
( 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 && \
|
|
apt-get install -y postgresql-17 postgresql-common postgresql-17-pglogical \
|
|
postgresql-17-cron postgresql-17-extra-window-functions \
|
|
postgresql-17-first-last-agg postgresql-17-jsquery postgresql-17-numeral \
|
|
postgresql-17-pglogical-ticker postgresql-17-pgmemcache \
|
|
postgresql-17-pgpcre postgresql-17-pgrouting postgresql-17-repack \
|
|
postgresql-17-pgrouting-scripts postgresql-17-pgsphere \
|
|
postgresql-17-postgis-3 postgresql-17-postgis-3-scripts \
|
|
postgresql-17-repack postgresql-17-set-user postgresql-17-similarity \
|
|
postgresql-17-pgpool2 postgresql-17-semver postgresql-17-repmgr \
|
|
postgresql-plperl-17 postgresql-plpython3-17 postgresql-17-age \
|
|
postgresql-17-pgvector postgresql-17-tablelog postgresql-17-wal2json \
|
|
apgdiff locales-all $SRV_APT_GET_INSTALL && \
|
|
apt-get clean && rm -rf ~/.cache && rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV PATH="/usr/lib/postgresql/17/bin:$PATH"
|
|
|
|
COPY docker-entrypoint.sh /
|
|
|
|
USER $SRV_UID:$SRV_GID
|
|
|
|
RUN ln -s $PGDATA/.bash_history $HOME/.bash_history
|
|
|
|
VOLUME $PGDATA
|
|
|
|
WORKDIR $PGDATA
|
|
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
|
|
STOPSIGNAL SIGINT
|
|
|
|
EXPOSE 5432
|
|
|
|
CMD ["postgres","-c","listen_addresses=*"]
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --retries=4 \
|
|
CMD pg_isready -U "${POSTGRES_USER:-postgres}"
|