57 lines
2 KiB
Docker
57 lines
2 KiB
Docker
FROM buildpack-deps:bullseye
|
|
|
|
ARG SRV_UID="1000"
|
|
ARG SRV_GID="100"
|
|
ARG SRV_VERSION="0"
|
|
|
|
ENV SRV_UID $SRV_UID
|
|
ENV SRV_GID $SRV_GID
|
|
ENV SRV_VERSION $SRV_VERSION
|
|
ENV SRV_APT_GET_INSTALL $SRV_APT_GET_INSTALL
|
|
|
|
ENV DEBIAN_FRONTEND "noninteractive"
|
|
ENV PGDATA "/data"
|
|
|
|
# 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 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-15 postgresql-common postgresql-15-pglogical \
|
|
postgresql-15-cron postgresql-15-extra-window-functions \
|
|
postgresql-15-first-last-agg postgresql-15-jsquery postgresql-15-numeral \
|
|
postgresql-15-pglogical-ticker postgresql-15-pgmemcache \
|
|
postgresql-15-pgpcre postgresql-15-pgrouting postgresql-15-repack \
|
|
postgresql-15-pgrouting-scripts postgresql-15-pgsphere \
|
|
postgresql-15-postgis-3 postgresql-15-postgis-3-scripts \
|
|
postgresql-15-repack postgresql-15-set-user postgresql-15-similarity \
|
|
postgresql-15-pgpool2 postgresql-15-semver postgresql-15-repmgr \
|
|
postgresql-15-tablelog postgresql-15-wal2json \
|
|
$SRV_APT_GET_INSTALL && \
|
|
apt-get clean && rm -rf ~/.cache && rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV PATH="/usr/lib/postgresql/15/bin:$PATH"
|
|
|
|
COPY docker-entrypoint.sh /usr/local/bin/
|
|
|
|
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"]
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --retries=4 \
|
|
CMD pg_isready -U ${POSTGRES_USER:-postgres}
|