Updated to PostgreSQL 16 and added proper locale settings

This commit is contained in:
Torsten Raudssus 2024-03-01 02:54:24 +01:00
parent 2473c1b924
commit a2e5e14cb6
2 changed files with 19 additions and 15 deletions

1
.gitignore vendored
View file

@ -27,6 +27,7 @@ node_modules
local local
tmp tmp
.parcel-cache .parcel-cache
.bash_history
.env .env
.mc .mc

View file

@ -2,40 +2,43 @@ FROM buildpack-deps:bullseye
ARG SRV_UID="1000" ARG SRV_UID="1000"
ARG SRV_GID="100" ARG SRV_GID="100"
ARG SRV_LOCALE="en_US"
ARG SRV_VERSION="0" ARG SRV_VERSION="0"
ENV SRV_UID $SRV_UID ENV SRV_UID $SRV_UID
ENV SRV_GID $SRV_GID ENV SRV_GID $SRV_GID
ENV SRV_LOCALE $SRV_LOCALE
ENV SRV_VERSION $SRV_VERSION ENV SRV_VERSION $SRV_VERSION
ENV SRV_APT_GET_INSTALL $SRV_APT_GET_INSTALL ENV SRV_APT_GET_INSTALL $SRV_APT_GET_INSTALL
ENV DEBIAN_FRONTEND "noninteractive" ENV DEBIAN_FRONTEND "noninteractive"
ENV PGDATA "/data" 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 # explicitly set user/group IDs
RUN if [ -z "$( getent group $SRV_GID )" ] ; then groupadd -r postgres --gid=$SRV_GID ; fi && \ 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 && \ 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 && \ mkdir -p $PGDATA && chown -R $SRV_UID:$SRV_GID $PGDATA && \
apt-get update -y && apt-get install -y lsb-release && \ 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 ) && \ ( 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 ) && \ ( 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 update -y && mkdir -p /docker-entrypoint-initdb.d && \
apt-get install -y postgresql-15 postgresql-common postgresql-15-pglogical \ apt-get install -y postgresql-16 postgresql-common postgresql-16-pglogical \
postgresql-15-cron postgresql-15-extra-window-functions \ postgresql-16-cron postgresql-16-extra-window-functions \
postgresql-15-first-last-agg postgresql-15-jsquery postgresql-15-numeral \ postgresql-16-first-last-agg postgresql-16-jsquery postgresql-16-numeral \
postgresql-15-pglogical-ticker postgresql-15-pgmemcache \ postgresql-16-pglogical-ticker postgresql-16-pgmemcache \
postgresql-15-pgpcre postgresql-15-pgrouting postgresql-15-repack \ postgresql-16-pgpcre postgresql-16-pgrouting postgresql-16-repack \
postgresql-15-pgrouting-scripts postgresql-15-pgsphere \ postgresql-16-pgrouting-scripts postgresql-16-pgsphere \
postgresql-15-postgis-3 postgresql-15-postgis-3-scripts \ postgresql-16-postgis-3 postgresql-16-postgis-3-scripts \
postgresql-15-repack postgresql-15-set-user postgresql-15-similarity \ postgresql-16-repack postgresql-16-set-user postgresql-16-similarity \
postgresql-15-pgpool2 postgresql-15-semver postgresql-15-repmgr \ postgresql-16-pgpool2 postgresql-16-semver postgresql-16-repmgr \
postgresql-15-tablelog postgresql-15-wal2json \ postgresql-16-tablelog postgresql-16-wal2json apgdiff locales-all \
$SRV_APT_GET_INSTALL && \ $SRV_APT_GET_INSTALL && \
apt-get clean && rm -rf ~/.cache && rm -rf /var/lib/apt/lists/* apt-get clean && rm -rf ~/.cache && rm -rf /var/lib/apt/lists/*
ENV PATH="/usr/lib/postgresql/15/bin:$PATH" ENV PATH="/usr/lib/postgresql/16/bin:$PATH"
COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-entrypoint.sh /
USER $SRV_UID:$SRV_GID USER $SRV_UID:$SRV_GID
@ -45,7 +48,7 @@ VOLUME $PGDATA
WORKDIR $PGDATA WORKDIR $PGDATA
ENTRYPOINT ["docker-entrypoint.sh"] ENTRYPOINT ["/docker-entrypoint.sh"]
STOPSIGNAL SIGINT STOPSIGNAL SIGINT