From 446ab90753daeb510265614cb5259f6e3403af9d Mon Sep 17 00:00:00 2001 From: Roman Vanicek Date: Sun, 29 Mar 2026 12:04:31 +0000 Subject: [PATCH] Allow upgrade from 14 to 15 --- Dockerfile | 6 ++++-- upgrade-entrypoint.sh | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7aa5561..15ba19a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,14 +7,16 @@ RUN go mod download RUN mkdir bin/ && go build -o bin/ ./... -FROM postgis/postgis:16-master +FROM postgis/postgis:15-3.4 COPY --from=builder /usr/local/src/pg_autoconfig/bin/pg_autoconfig / COPY upgrade-entrypoint.sh / RUN localedef -i cs_CZ -c -f UTF-8 -A /usr/share/locale/locale.alias cz_CZ.UTF-8 && \ - apt-get update && apt-get install -y postgresql-16-auto-failover pg-auto-failover-cli postgresql-16-pgvector && \ + apt-get update && apt-get install -y postgresql-15-auto-failover pg-auto-failover-cli postgresql-15-pgvector \ + # Include previous postgres version to allow automatic upgrade + postgresql-14 postgresql-14-postgis-3 postgresql-14-pgvector && \ rm -rf /var/lib/apt/lists/* && \ chmod +x /upgrade-entrypoint.sh diff --git a/upgrade-entrypoint.sh b/upgrade-entrypoint.sh index b726c1a..c47f27d 100644 --- a/upgrade-entrypoint.sh +++ b/upgrade-entrypoint.sh @@ -3,7 +3,9 @@ set -e DATA_DIR="/var/lib/postgresql/data" OLD_VERSION_FILE="$DATA_DIR/PG_VERSION" -NEW_VERSION="16" +NEW_VERSION="15" +OLD_BIN="/usr/lib/postgresql/14/bin" +NEW_BIN="/usr/lib/postgresql/15/bin" if [ -f "$OLD_VERSION_FILE" ]; then OLD_VERSION=$(cat "$OLD_VERSION_FILE") @@ -27,8 +29,8 @@ if [ -f "$OLD_VERSION_FILE" ]; then pg_upgrade \ -d $DATA_DIR/old_data \ -D $DATA_DIR/new_data \ - -b /usr/bin/postgres-16 \ - -B /usr/local/bin \ + -b "$OLD_BIN" \ + -B "$NEW_BIN" \ --link # Clean-up