2023-03-19 07:55:01 +01:00
|
|
|
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
|
2023-03-20 04:46:47 +01:00
|
|
|
ENV SRV_APT_GET_INSTALL $SRV_APT_GET_INSTALL
|
2023-03-19 07:55:01 +01:00
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND "noninteractive"
|
|
|
|
ENV PGDATA "/pgdata"
|
|
|
|
|
|
|
|
# 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 && \
|
2023-03-19 22:37:29 +01:00
|
|
|
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-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 \
|
2023-03-20 04:46:47 +01:00
|
|
|
postgresql-15-tablelog postgresql-15-wal2json $SRV_APT_GET_INSTALL && \
|
2023-03-19 22:37:29 +01:00
|
|
|
apt-get clean
|
|
|
|
|
|
|
|
ENV PATH="/usr/lib/postgresql/15/bin:$PATH"
|
2023-03-19 07:55:01 +01:00
|
|
|
|
|
|
|
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}
|