From 6b7b465719230b983a7a6312d5c7d22da8b90a1e Mon Sep 17 00:00:00 2001 From: ImreSamu Date: Sat, 31 Oct 2026 04:00:17 +0100 Subject: [PATCH 1/2] upgrade to postgis 3.7 --- .github/workflows/main.yml | 19 +-- {14-3.6 => 14-3.7}/Dockerfile | 4 +- {14-3.6 => 14-3.7}/alpine/Dockerfile | 8 +- {14-3.6 => 14-3.7}/alpine/initdb-postgis.sh | 0 {14-3.6 => 14-3.7}/alpine/update-postgis.sh | 0 {14-3.6 => 14-3.7}/initdb-postgis.sh | 0 {14-3.6 => 14-3.7}/update-postgis.sh | 0 {15-3.6 => 15-3.7}/Dockerfile | 4 +- {15-3.6 => 15-3.7}/alpine/Dockerfile | 8 +- {15-3.6 => 15-3.7}/alpine/initdb-postgis.sh | 0 {15-3.6 => 15-3.7}/alpine/update-postgis.sh | 0 {15-3.6 => 15-3.7}/initdb-postgis.sh | 0 {15-3.6 => 15-3.7}/update-postgis.sh | 0 {16-3.6 => 16-3.7}/Dockerfile | 4 +- {16-3.6 => 16-3.7}/alpine/Dockerfile | 8 +- {16-3.6 => 16-3.7}/alpine/initdb-postgis.sh | 0 {16-3.6 => 16-3.7}/alpine/update-postgis.sh | 0 {16-3.6 => 16-3.7}/initdb-postgis.sh | 0 {16-3.6 => 16-3.7}/update-postgis.sh | 0 16-master/Dockerfile | 14 +- {17-3.6 => 17-3.7}/Dockerfile | 4 +- {17-3.6 => 17-3.7}/alpine/Dockerfile | 8 +- {17-3.6 => 17-3.7}/alpine/initdb-postgis.sh | 0 {17-3.6 => 17-3.7}/alpine/update-postgis.sh | 0 {17-3.6 => 17-3.7}/initdb-postgis.sh | 0 {17-3.6 => 17-3.7}/update-postgis.sh | 0 17-master/Dockerfile | 14 +- 18-3.7.0rc3/Dockerfile | 3 - 18-3.7.0rc3/alpine/Dockerfile | 147 ------------------ {18-3.6 => 18-3.7}/Dockerfile | 4 +- {18-3.6 => 18-3.7}/alpine/Dockerfile | 8 +- {18-3.6 => 18-3.7}/alpine/initdb-postgis.sh | 0 {18-3.6 => 18-3.7}/alpine/update-postgis.sh | 0 {18-3.6 => 18-3.7}/initdb-postgis.sh | 0 {18-3.6 => 18-3.7}/update-postgis.sh | 0 18-master/Dockerfile | 14 +- 19rc1-3.6/initdb-postgis.sh | 41 ----- 19rc1-3.6/update-postgis.sh | 28 ---- 19rc1-3.7.0rc3/Dockerfile | 3 - 19rc1-3.7.0rc3/alpine/Dockerfile | 147 ------------------ 19rc1-3.7.0rc3/alpine/initdb-postgis.sh | 41 ----- 19rc1-3.7.0rc3/alpine/update-postgis.sh | 28 ---- {19rc1-3.6 => 19rc1-3.7}/Dockerfile | 4 +- {19rc1-3.6 => 19rc1-3.7}/alpine/Dockerfile | 8 +- .../alpine/initdb-postgis.sh | 0 .../alpine/update-postgis.sh | 0 .../alpine => 19rc1-3.7}/initdb-postgis.sh | 0 .../alpine => 19rc1-3.7}/update-postgis.sh | 0 19rc1-master/Dockerfile | 14 +- Dockerfile.alpine.template | 2 +- Makefile | 2 +- README.md | 48 +++--- 52 files changed, 89 insertions(+), 548 deletions(-) rename {14-3.6 => 14-3.7}/Dockerfile (90%) rename {14-3.6 => 14-3.7}/alpine/Dockerfile (95%) rename {14-3.6 => 14-3.7}/alpine/initdb-postgis.sh (100%) rename {14-3.6 => 14-3.7}/alpine/update-postgis.sh (100%) rename {14-3.6 => 14-3.7}/initdb-postgis.sh (100%) rename {14-3.6 => 14-3.7}/update-postgis.sh (100%) rename {15-3.6 => 15-3.7}/Dockerfile (90%) rename {15-3.6 => 15-3.7}/alpine/Dockerfile (95%) rename {15-3.6 => 15-3.7}/alpine/initdb-postgis.sh (100%) rename {15-3.6 => 15-3.7}/alpine/update-postgis.sh (100%) rename {15-3.6 => 15-3.7}/initdb-postgis.sh (100%) rename {15-3.6 => 15-3.7}/update-postgis.sh (100%) rename {16-3.6 => 16-3.7}/Dockerfile (90%) rename {16-3.6 => 16-3.7}/alpine/Dockerfile (95%) rename {16-3.6 => 16-3.7}/alpine/initdb-postgis.sh (100%) rename {16-3.6 => 16-3.7}/alpine/update-postgis.sh (100%) rename {16-3.6 => 16-3.7}/initdb-postgis.sh (100%) rename {16-3.6 => 16-3.7}/update-postgis.sh (100%) rename {17-3.6 => 17-3.7}/Dockerfile (90%) rename {17-3.6 => 17-3.7}/alpine/Dockerfile (95%) rename {17-3.6 => 17-3.7}/alpine/initdb-postgis.sh (100%) rename {17-3.6 => 17-3.7}/alpine/update-postgis.sh (100%) rename {17-3.6 => 17-3.7}/initdb-postgis.sh (100%) rename {17-3.6 => 17-3.7}/update-postgis.sh (100%) delete mode 100644 18-3.7.0rc3/Dockerfile delete mode 100644 18-3.7.0rc3/alpine/Dockerfile rename {18-3.6 => 18-3.7}/Dockerfile (90%) rename {18-3.6 => 18-3.7}/alpine/Dockerfile (95%) rename {18-3.6 => 18-3.7}/alpine/initdb-postgis.sh (100%) rename {18-3.6 => 18-3.7}/alpine/update-postgis.sh (100%) rename {18-3.6 => 18-3.7}/initdb-postgis.sh (100%) rename {18-3.6 => 18-3.7}/update-postgis.sh (100%) delete mode 100644 19rc1-3.6/initdb-postgis.sh delete mode 100755 19rc1-3.6/update-postgis.sh delete mode 100644 19rc1-3.7.0rc3/Dockerfile delete mode 100644 19rc1-3.7.0rc3/alpine/Dockerfile delete mode 100644 19rc1-3.7.0rc3/alpine/initdb-postgis.sh delete mode 100755 19rc1-3.7.0rc3/alpine/update-postgis.sh rename {19rc1-3.6 => 19rc1-3.7}/Dockerfile (90%) rename {19rc1-3.6 => 19rc1-3.7}/alpine/Dockerfile (95%) rename {18-3.7.0rc3 => 19rc1-3.7}/alpine/initdb-postgis.sh (100%) rename {18-3.7.0rc3 => 19rc1-3.7}/alpine/update-postgis.sh (100%) rename {19rc1-3.6/alpine => 19rc1-3.7}/initdb-postgis.sh (100%) rename {19rc1-3.6/alpine => 19rc1-3.7}/update-postgis.sh (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 078291931..c29a24e60 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: matrix: runner-platform: ['ubuntu-24.04', 'ubuntu-24.04-arm'] postgres: [14, 15, 16, 17, 18, 19rc1] - postgis: ['3.6'] + postgis: ['3.7'] variant: [default, alpine] include: - postgres: 16 @@ -52,23 +52,6 @@ jobs: postgis: master variant: default runner-platform: 'ubuntu-24.04-arm' - - postgres: 19rc1 - postgis: '3.7.0rc3' - variant: alpine - runner-platform: 'ubuntu-24.04' - - postgres: 19rc1 - postgis: '3.7.0rc3' - variant: alpine - runner-platform: 'ubuntu-24.04-arm' - - - postgres: 18 - postgis: '3.7.0rc3' - variant: alpine - runner-platform: 'ubuntu-24.04' - - postgres: 18 - postgis: '3.7.0rc3' - variant: alpine - runner-platform: 'ubuntu-24.04-arm' name: ${{ matrix.postgres }}-${{ matrix.postgis }}-${{ matrix.variant }} ${{ matrix.runner-platform }} - Build Docker image runs-on: ${{ matrix.runner-platform }} diff --git a/14-3.6/Dockerfile b/14-3.7/Dockerfile similarity index 90% rename from 14-3.6/Dockerfile rename to 14-3.7/Dockerfile index 157180d3d..ad0b40b8e 100644 --- a/14-3.6/Dockerfile +++ b/14-3.7/Dockerfile @@ -5,11 +5,11 @@ FROM docker.io/postgres:14-trixie LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4+dfsg-2.pgdg13+1 spatial database extension with PostgreSQL 14 trixie" \ + org.opencontainers.image.description="PostGIS 3.7.0+dfsg-1.pgdg13+1 spatial database extension with PostgreSQL 14 trixie" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR=3 -ENV POSTGIS_VERSION=3.6.4+dfsg-2.pgdg13+1 +ENV POSTGIS_VERSION=3.7.0+dfsg-1.pgdg13+1 RUN apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ diff --git a/14-3.6/alpine/Dockerfile b/14-3.7/alpine/Dockerfile similarity index 95% rename from 14-3.6/alpine/Dockerfile rename to 14-3.7/alpine/Dockerfile index 89162f2c9..c68455d6e 100644 --- a/14-3.6/alpine/Dockerfile +++ b/14-3.7/alpine/Dockerfile @@ -7,11 +7,11 @@ FROM ${BASE_IMAGE} ARG NPROC= LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4 spatial database extension with PostgreSQL 14 Alpine" \ + org.opencontainers.image.description="PostGIS 3.7.0 spatial database extension with PostgreSQL 14 Alpine" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION=3.6.4 -ENV POSTGIS_SHA256=4f80e1a4d227f088ae818f79180debd5894c075615823e0f556f73479cf1f200 +ENV POSTGIS_VERSION=3.7.0 +ENV POSTGIS_SHA256=306d68a115b88c59d9ffbd134b28fd1b0eccb7b0dabcbb5df2dc0b009d9de848 RUN set -eux \ && apk add --no-cache --virtual .fetch-deps \ @@ -89,7 +89,7 @@ RUN set -eux \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ # Optional extensions: create them only if they are available. - # Since PostGIS 3.7.0rc, some builds may not include them. + # Since PostGIS 3.7, some builds may not include them. # PostGIS 3.6.x still includes them. # See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html && su postgres -c "psql -v ON_ERROR_STOP=1 -c \" \ diff --git a/14-3.6/alpine/initdb-postgis.sh b/14-3.7/alpine/initdb-postgis.sh similarity index 100% rename from 14-3.6/alpine/initdb-postgis.sh rename to 14-3.7/alpine/initdb-postgis.sh diff --git a/14-3.6/alpine/update-postgis.sh b/14-3.7/alpine/update-postgis.sh similarity index 100% rename from 14-3.6/alpine/update-postgis.sh rename to 14-3.7/alpine/update-postgis.sh diff --git a/14-3.6/initdb-postgis.sh b/14-3.7/initdb-postgis.sh similarity index 100% rename from 14-3.6/initdb-postgis.sh rename to 14-3.7/initdb-postgis.sh diff --git a/14-3.6/update-postgis.sh b/14-3.7/update-postgis.sh similarity index 100% rename from 14-3.6/update-postgis.sh rename to 14-3.7/update-postgis.sh diff --git a/15-3.6/Dockerfile b/15-3.7/Dockerfile similarity index 90% rename from 15-3.6/Dockerfile rename to 15-3.7/Dockerfile index efb563c7d..753fecea3 100644 --- a/15-3.6/Dockerfile +++ b/15-3.7/Dockerfile @@ -5,11 +5,11 @@ FROM docker.io/postgres:15-trixie LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4+dfsg-2.pgdg13+1 spatial database extension with PostgreSQL 15 trixie" \ + org.opencontainers.image.description="PostGIS 3.7.0+dfsg-1.pgdg13+1 spatial database extension with PostgreSQL 15 trixie" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR=3 -ENV POSTGIS_VERSION=3.6.4+dfsg-2.pgdg13+1 +ENV POSTGIS_VERSION=3.7.0+dfsg-1.pgdg13+1 RUN apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ diff --git a/15-3.6/alpine/Dockerfile b/15-3.7/alpine/Dockerfile similarity index 95% rename from 15-3.6/alpine/Dockerfile rename to 15-3.7/alpine/Dockerfile index 6db06fe55..3db6dd98a 100644 --- a/15-3.6/alpine/Dockerfile +++ b/15-3.7/alpine/Dockerfile @@ -7,11 +7,11 @@ FROM ${BASE_IMAGE} ARG NPROC= LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4 spatial database extension with PostgreSQL 15 Alpine" \ + org.opencontainers.image.description="PostGIS 3.7.0 spatial database extension with PostgreSQL 15 Alpine" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION=3.6.4 -ENV POSTGIS_SHA256=4f80e1a4d227f088ae818f79180debd5894c075615823e0f556f73479cf1f200 +ENV POSTGIS_VERSION=3.7.0 +ENV POSTGIS_SHA256=306d68a115b88c59d9ffbd134b28fd1b0eccb7b0dabcbb5df2dc0b009d9de848 RUN set -eux \ && apk add --no-cache --virtual .fetch-deps \ @@ -89,7 +89,7 @@ RUN set -eux \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ # Optional extensions: create them only if they are available. - # Since PostGIS 3.7.0rc, some builds may not include them. + # Since PostGIS 3.7, some builds may not include them. # PostGIS 3.6.x still includes them. # See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html && su postgres -c "psql -v ON_ERROR_STOP=1 -c \" \ diff --git a/15-3.6/alpine/initdb-postgis.sh b/15-3.7/alpine/initdb-postgis.sh similarity index 100% rename from 15-3.6/alpine/initdb-postgis.sh rename to 15-3.7/alpine/initdb-postgis.sh diff --git a/15-3.6/alpine/update-postgis.sh b/15-3.7/alpine/update-postgis.sh similarity index 100% rename from 15-3.6/alpine/update-postgis.sh rename to 15-3.7/alpine/update-postgis.sh diff --git a/15-3.6/initdb-postgis.sh b/15-3.7/initdb-postgis.sh similarity index 100% rename from 15-3.6/initdb-postgis.sh rename to 15-3.7/initdb-postgis.sh diff --git a/15-3.6/update-postgis.sh b/15-3.7/update-postgis.sh similarity index 100% rename from 15-3.6/update-postgis.sh rename to 15-3.7/update-postgis.sh diff --git a/16-3.6/Dockerfile b/16-3.7/Dockerfile similarity index 90% rename from 16-3.6/Dockerfile rename to 16-3.7/Dockerfile index 8095b7300..7c5727692 100644 --- a/16-3.6/Dockerfile +++ b/16-3.7/Dockerfile @@ -5,11 +5,11 @@ FROM docker.io/postgres:16-trixie LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4+dfsg-2.pgdg13+1 spatial database extension with PostgreSQL 16 trixie" \ + org.opencontainers.image.description="PostGIS 3.7.0+dfsg-1.pgdg13+1 spatial database extension with PostgreSQL 16 trixie" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR=3 -ENV POSTGIS_VERSION=3.6.4+dfsg-2.pgdg13+1 +ENV POSTGIS_VERSION=3.7.0+dfsg-1.pgdg13+1 RUN apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ diff --git a/16-3.6/alpine/Dockerfile b/16-3.7/alpine/Dockerfile similarity index 95% rename from 16-3.6/alpine/Dockerfile rename to 16-3.7/alpine/Dockerfile index 307919e7f..05a0094e6 100644 --- a/16-3.6/alpine/Dockerfile +++ b/16-3.7/alpine/Dockerfile @@ -7,11 +7,11 @@ FROM ${BASE_IMAGE} ARG NPROC= LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4 spatial database extension with PostgreSQL 16 Alpine" \ + org.opencontainers.image.description="PostGIS 3.7.0 spatial database extension with PostgreSQL 16 Alpine" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION=3.6.4 -ENV POSTGIS_SHA256=4f80e1a4d227f088ae818f79180debd5894c075615823e0f556f73479cf1f200 +ENV POSTGIS_VERSION=3.7.0 +ENV POSTGIS_SHA256=306d68a115b88c59d9ffbd134b28fd1b0eccb7b0dabcbb5df2dc0b009d9de848 RUN set -eux \ && apk add --no-cache --virtual .fetch-deps \ @@ -89,7 +89,7 @@ RUN set -eux \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ # Optional extensions: create them only if they are available. - # Since PostGIS 3.7.0rc, some builds may not include them. + # Since PostGIS 3.7, some builds may not include them. # PostGIS 3.6.x still includes them. # See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html && su postgres -c "psql -v ON_ERROR_STOP=1 -c \" \ diff --git a/16-3.6/alpine/initdb-postgis.sh b/16-3.7/alpine/initdb-postgis.sh similarity index 100% rename from 16-3.6/alpine/initdb-postgis.sh rename to 16-3.7/alpine/initdb-postgis.sh diff --git a/16-3.6/alpine/update-postgis.sh b/16-3.7/alpine/update-postgis.sh similarity index 100% rename from 16-3.6/alpine/update-postgis.sh rename to 16-3.7/alpine/update-postgis.sh diff --git a/16-3.6/initdb-postgis.sh b/16-3.7/initdb-postgis.sh similarity index 100% rename from 16-3.6/initdb-postgis.sh rename to 16-3.7/initdb-postgis.sh diff --git a/16-3.6/update-postgis.sh b/16-3.7/update-postgis.sh similarity index 100% rename from 16-3.6/update-postgis.sh rename to 16-3.7/update-postgis.sh diff --git a/16-master/Dockerfile b/16-master/Dockerfile index 61ababfc8..846e22f2a 100644 --- a/16-master/Dockerfile +++ b/16-master/Dockerfile @@ -114,7 +114,7 @@ RUN set -ex \ # CGAL and SFCGAL. ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=e13f4e9be9def5a9f670adfa799463948796091c +ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 RUN set -ex \ && mkdir -p /usr/src \ @@ -182,7 +182,7 @@ RUN set -ex \ && rm -fr /usr/src/PROJ # GEOS. -ENV GEOS_GIT_HASH=283e82726fbd5ecc45397f182e12e056a65b2dd7 +ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c RUN set -ex \ && cd /usr/src \ && git clone https://github.com/libgeos/geos.git \ @@ -198,7 +198,7 @@ RUN set -ex \ && rm -fr /usr/src/geos # GDAL. -ENV GDAL_GIT_HASH=940f7198429fc578694b108631dfe5afd77efd2f +ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/gdal.git \ @@ -345,11 +345,11 @@ COPY --from=builder /usr/local /usr/local ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=e13f4e9be9def5a9f670adfa799463948796091c +ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 -ENV GEOS_GIT_HASH=283e82726fbd5ecc45397f182e12e056a65b2dd7 -ENV GDAL_GIT_HASH=940f7198429fc578694b108631dfe5afd77efd2f +ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c +ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 # Minimal command-line smoke test (fail fast). RUN set -ex \ @@ -368,7 +368,7 @@ RUN set -ex \ || echo "ogr2ogr missing PostgreSQL driver" && exit 1 # Install PostGIS and companion development extensions. -ENV POSTGIS_GIT_HASH=4db4d8050012b7a84e70ed11629bbc71daa20b6e +ENV POSTGIS_GIT_HASH=358ee965988ba72ecd47601205c99b9e91cc037e ENV H3_PG_GIT_HASH=f960a574eab6aebd186dedff6204711c21742f12 ENV ADDRESS_STANDARDIZER_GIT_HASH=ba9a26a013f23908657bb26574ae436b11d4b811 diff --git a/17-3.6/Dockerfile b/17-3.7/Dockerfile similarity index 90% rename from 17-3.6/Dockerfile rename to 17-3.7/Dockerfile index 81ca33c71..b9f8bca42 100644 --- a/17-3.6/Dockerfile +++ b/17-3.7/Dockerfile @@ -5,11 +5,11 @@ FROM docker.io/postgres:17-trixie LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4+dfsg-2.pgdg13+1 spatial database extension with PostgreSQL 17 trixie" \ + org.opencontainers.image.description="PostGIS 3.7.0+dfsg-1.pgdg13+1 spatial database extension with PostgreSQL 17 trixie" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR=3 -ENV POSTGIS_VERSION=3.6.4+dfsg-2.pgdg13+1 +ENV POSTGIS_VERSION=3.7.0+dfsg-1.pgdg13+1 RUN apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ diff --git a/17-3.6/alpine/Dockerfile b/17-3.7/alpine/Dockerfile similarity index 95% rename from 17-3.6/alpine/Dockerfile rename to 17-3.7/alpine/Dockerfile index 23371f7a6..4b5e8c825 100644 --- a/17-3.6/alpine/Dockerfile +++ b/17-3.7/alpine/Dockerfile @@ -7,11 +7,11 @@ FROM ${BASE_IMAGE} ARG NPROC= LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4 spatial database extension with PostgreSQL 17 Alpine" \ + org.opencontainers.image.description="PostGIS 3.7.0 spatial database extension with PostgreSQL 17 Alpine" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION=3.6.4 -ENV POSTGIS_SHA256=4f80e1a4d227f088ae818f79180debd5894c075615823e0f556f73479cf1f200 +ENV POSTGIS_VERSION=3.7.0 +ENV POSTGIS_SHA256=306d68a115b88c59d9ffbd134b28fd1b0eccb7b0dabcbb5df2dc0b009d9de848 RUN set -eux \ && apk add --no-cache --virtual .fetch-deps \ @@ -89,7 +89,7 @@ RUN set -eux \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ # Optional extensions: create them only if they are available. - # Since PostGIS 3.7.0rc, some builds may not include them. + # Since PostGIS 3.7, some builds may not include them. # PostGIS 3.6.x still includes them. # See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html && su postgres -c "psql -v ON_ERROR_STOP=1 -c \" \ diff --git a/17-3.6/alpine/initdb-postgis.sh b/17-3.7/alpine/initdb-postgis.sh similarity index 100% rename from 17-3.6/alpine/initdb-postgis.sh rename to 17-3.7/alpine/initdb-postgis.sh diff --git a/17-3.6/alpine/update-postgis.sh b/17-3.7/alpine/update-postgis.sh similarity index 100% rename from 17-3.6/alpine/update-postgis.sh rename to 17-3.7/alpine/update-postgis.sh diff --git a/17-3.6/initdb-postgis.sh b/17-3.7/initdb-postgis.sh similarity index 100% rename from 17-3.6/initdb-postgis.sh rename to 17-3.7/initdb-postgis.sh diff --git a/17-3.6/update-postgis.sh b/17-3.7/update-postgis.sh similarity index 100% rename from 17-3.6/update-postgis.sh rename to 17-3.7/update-postgis.sh diff --git a/17-master/Dockerfile b/17-master/Dockerfile index 54533b114..d2d4dcd58 100644 --- a/17-master/Dockerfile +++ b/17-master/Dockerfile @@ -114,7 +114,7 @@ RUN set -ex \ # CGAL and SFCGAL. ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=e13f4e9be9def5a9f670adfa799463948796091c +ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 RUN set -ex \ && mkdir -p /usr/src \ @@ -182,7 +182,7 @@ RUN set -ex \ && rm -fr /usr/src/PROJ # GEOS. -ENV GEOS_GIT_HASH=283e82726fbd5ecc45397f182e12e056a65b2dd7 +ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c RUN set -ex \ && cd /usr/src \ && git clone https://github.com/libgeos/geos.git \ @@ -198,7 +198,7 @@ RUN set -ex \ && rm -fr /usr/src/geos # GDAL. -ENV GDAL_GIT_HASH=940f7198429fc578694b108631dfe5afd77efd2f +ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/gdal.git \ @@ -345,11 +345,11 @@ COPY --from=builder /usr/local /usr/local ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=e13f4e9be9def5a9f670adfa799463948796091c +ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 -ENV GEOS_GIT_HASH=283e82726fbd5ecc45397f182e12e056a65b2dd7 -ENV GDAL_GIT_HASH=940f7198429fc578694b108631dfe5afd77efd2f +ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c +ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 # Minimal command-line smoke test (fail fast). RUN set -ex \ @@ -368,7 +368,7 @@ RUN set -ex \ || echo "ogr2ogr missing PostgreSQL driver" && exit 1 # Install PostGIS and companion development extensions. -ENV POSTGIS_GIT_HASH=4db4d8050012b7a84e70ed11629bbc71daa20b6e +ENV POSTGIS_GIT_HASH=358ee965988ba72ecd47601205c99b9e91cc037e ENV H3_PG_GIT_HASH=f960a574eab6aebd186dedff6204711c21742f12 ENV ADDRESS_STANDARDIZER_GIT_HASH=ba9a26a013f23908657bb26574ae436b11d4b811 diff --git a/18-3.7.0rc3/Dockerfile b/18-3.7.0rc3/Dockerfile deleted file mode 100644 index 51881a02f..000000000 --- a/18-3.7.0rc3/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ - # placeholder Dockerfile - # Debian version of postgis is not detected! - # This is an autogenerated message of ./update.sh diff --git a/18-3.7.0rc3/alpine/Dockerfile b/18-3.7.0rc3/alpine/Dockerfile deleted file mode 100644 index 8d97b8568..000000000 --- a/18-3.7.0rc3/alpine/Dockerfile +++ /dev/null @@ -1,147 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. -# -ARG BASE_IMAGE=postgres:18-alpine3.24 -FROM ${BASE_IMAGE} - -ARG NPROC= - -LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.7.0rc3 spatial database extension with PostgreSQL 18 Alpine" \ - org.opencontainers.image.source="https://github.com/postgis/docker-postgis" - -ENV POSTGIS_VERSION=3.7.0rc3 -ENV POSTGIS_SHA256=77a63e7aa49665764974ddd3c904235ae344267452ce26e1ff7b6f048527dfd3 - -RUN set -eux \ - && apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - openssl \ - tar \ - \ - && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ - && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/src/postgis \ - && tar \ - --extract \ - --file postgis.tar.gz \ - --directory /usr/src/postgis \ - --strip-components 1 \ - && rm postgis.tar.gz \ - \ - && apk add --no-cache --virtual .build-deps \ - \ - gdal-dev \ - geos-dev \ - gmp-dev \ - proj-dev \ - proj-util \ - sfcgal-dev \ - \ - # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains - # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. - # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 - $DOCKER_PG_LLVM_DEPS \ - \ - autoconf \ - automake \ - cunit-dev \ - file \ - g++ \ - gcc \ - gettext-dev \ - git \ - json-c-dev \ - libtool \ - libxml2-dev \ - make \ - pcre2-dev \ - perl \ - protobuf-c-dev \ - \ -# build PostGIS - with Link Time Optimization (LTO) enabled - && cd /usr/src/postgis \ - && gettextize \ - && ./autogen.sh \ - && ./configure \ - --enable-lto \ - && make -j${NPROC:-$(nproc)} \ - && make install \ - \ -# This section is for refreshing the proj data for the regression tests. -# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 -# This increases the Docker image size by about 1 MB. - && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ - && projsync --system-directory --file us_noaa_eshpgn \ - && projsync --system-directory --file us_noaa_prvi \ - && projsync --system-directory --file us_noaa_wmhpgn \ -# This section performs a regression check. - && mkdir /tempdb \ - && chown -R postgres:postgres /tempdb \ - && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ - && cd regress \ - && make -j${NPROC:-$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \ - \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ - # Optional extensions: create them only if they are available. - # Since PostGIS 3.7.0rc, some builds may not include them. - # PostGIS 3.6.x still includes them. - # See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html - && su postgres -c "psql -v ON_ERROR_STOP=1 -c \" \ - DO \\\$\\\$ \ - DECLARE \ - extension_name text; \ - BEGIN \ - FOREACH extension_name IN ARRAY ARRAY[ \ - 'address_standardizer', \ - 'address_standardizer_data_us', \ - 'postgis_tiger_geocoder' \ - ] LOOP \ - IF EXISTS (SELECT 1 FROM pg_available_extensions WHERE name = extension_name) THEN \ - EXECUTE format('CREATE EXTENSION IF NOT EXISTS %I', extension_name); \ - ELSE \ - RAISE NOTICE 'Extension % is not available, skipping', extension_name; \ - END IF; \ - END LOOP; \ - END \ - \\\$\\\$;\"" \ - && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ - \ - && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ - && rm -rf /tempdb \ - && rm -rf /tmp/logfile \ - && rm -rf /tmp/pgis_reg \ -# add .postgis-rundeps - && apk add --no-cache --virtual .postgis-rundeps \ - \ - gdal \ - geos \ - gmp \ - proj \ - sfcgal \ - \ - json-c \ - libstdc++ \ - pcre2 \ - protobuf-c \ - \ - # ca-certificates: for accessing remote raster files - # fix https://github.com/postgis/docker-postgis/issues/307 - ca-certificates \ -# clean - && cd / \ - && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ -# At the end of the build, we print the collected information -# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. - && cat /_pgis_full_version.txt - -COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh -COPY ./update-postgis.sh /usr/local/bin diff --git a/18-3.6/Dockerfile b/18-3.7/Dockerfile similarity index 90% rename from 18-3.6/Dockerfile rename to 18-3.7/Dockerfile index 7b5b7c29c..0f7afb2a1 100644 --- a/18-3.6/Dockerfile +++ b/18-3.7/Dockerfile @@ -5,11 +5,11 @@ FROM docker.io/postgres:18-trixie LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4+dfsg-2.pgdg13+1 spatial database extension with PostgreSQL 18 trixie" \ + org.opencontainers.image.description="PostGIS 3.7.0+dfsg-1.pgdg13+1 spatial database extension with PostgreSQL 18 trixie" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR=3 -ENV POSTGIS_VERSION=3.6.4+dfsg-2.pgdg13+1 +ENV POSTGIS_VERSION=3.7.0+dfsg-1.pgdg13+1 RUN apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ diff --git a/18-3.6/alpine/Dockerfile b/18-3.7/alpine/Dockerfile similarity index 95% rename from 18-3.6/alpine/Dockerfile rename to 18-3.7/alpine/Dockerfile index e52e4b422..88210655e 100644 --- a/18-3.6/alpine/Dockerfile +++ b/18-3.7/alpine/Dockerfile @@ -7,11 +7,11 @@ FROM ${BASE_IMAGE} ARG NPROC= LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4 spatial database extension with PostgreSQL 18 Alpine" \ + org.opencontainers.image.description="PostGIS 3.7.0 spatial database extension with PostgreSQL 18 Alpine" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION=3.6.4 -ENV POSTGIS_SHA256=4f80e1a4d227f088ae818f79180debd5894c075615823e0f556f73479cf1f200 +ENV POSTGIS_VERSION=3.7.0 +ENV POSTGIS_SHA256=306d68a115b88c59d9ffbd134b28fd1b0eccb7b0dabcbb5df2dc0b009d9de848 RUN set -eux \ && apk add --no-cache --virtual .fetch-deps \ @@ -89,7 +89,7 @@ RUN set -eux \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ # Optional extensions: create them only if they are available. - # Since PostGIS 3.7.0rc, some builds may not include them. + # Since PostGIS 3.7, some builds may not include them. # PostGIS 3.6.x still includes them. # See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html && su postgres -c "psql -v ON_ERROR_STOP=1 -c \" \ diff --git a/18-3.6/alpine/initdb-postgis.sh b/18-3.7/alpine/initdb-postgis.sh similarity index 100% rename from 18-3.6/alpine/initdb-postgis.sh rename to 18-3.7/alpine/initdb-postgis.sh diff --git a/18-3.6/alpine/update-postgis.sh b/18-3.7/alpine/update-postgis.sh similarity index 100% rename from 18-3.6/alpine/update-postgis.sh rename to 18-3.7/alpine/update-postgis.sh diff --git a/18-3.6/initdb-postgis.sh b/18-3.7/initdb-postgis.sh similarity index 100% rename from 18-3.6/initdb-postgis.sh rename to 18-3.7/initdb-postgis.sh diff --git a/18-3.6/update-postgis.sh b/18-3.7/update-postgis.sh similarity index 100% rename from 18-3.6/update-postgis.sh rename to 18-3.7/update-postgis.sh diff --git a/18-master/Dockerfile b/18-master/Dockerfile index 9af573b40..5d1354bf1 100644 --- a/18-master/Dockerfile +++ b/18-master/Dockerfile @@ -114,7 +114,7 @@ RUN set -ex \ # CGAL and SFCGAL. ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=e13f4e9be9def5a9f670adfa799463948796091c +ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 RUN set -ex \ && mkdir -p /usr/src \ @@ -182,7 +182,7 @@ RUN set -ex \ && rm -fr /usr/src/PROJ # GEOS. -ENV GEOS_GIT_HASH=283e82726fbd5ecc45397f182e12e056a65b2dd7 +ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c RUN set -ex \ && cd /usr/src \ && git clone https://github.com/libgeos/geos.git \ @@ -198,7 +198,7 @@ RUN set -ex \ && rm -fr /usr/src/geos # GDAL. -ENV GDAL_GIT_HASH=940f7198429fc578694b108631dfe5afd77efd2f +ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/gdal.git \ @@ -345,11 +345,11 @@ COPY --from=builder /usr/local /usr/local ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=e13f4e9be9def5a9f670adfa799463948796091c +ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 -ENV GEOS_GIT_HASH=283e82726fbd5ecc45397f182e12e056a65b2dd7 -ENV GDAL_GIT_HASH=940f7198429fc578694b108631dfe5afd77efd2f +ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c +ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 # Minimal command-line smoke test (fail fast). RUN set -ex \ @@ -368,7 +368,7 @@ RUN set -ex \ || echo "ogr2ogr missing PostgreSQL driver" && exit 1 # Install PostGIS and companion development extensions. -ENV POSTGIS_GIT_HASH=4db4d8050012b7a84e70ed11629bbc71daa20b6e +ENV POSTGIS_GIT_HASH=358ee965988ba72ecd47601205c99b9e91cc037e ENV H3_PG_GIT_HASH=f960a574eab6aebd186dedff6204711c21742f12 ENV ADDRESS_STANDARDIZER_GIT_HASH=ba9a26a013f23908657bb26574ae436b11d4b811 diff --git a/19rc1-3.6/initdb-postgis.sh b/19rc1-3.6/initdb-postgis.sh deleted file mode 100644 index ae56ee0ba..000000000 --- a/19rc1-3.6/initdb-postgis.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - -- - DO $$ - DECLARE - postgis_major integer; - postgis_minor integer; - BEGIN - SELECT substring(postgis_lib_version() from '^([0-9]+)')::integer, - substring(postgis_lib_version() from '^[0-9]+\.([0-9]+)')::integer - INTO postgis_major, postgis_minor; - - -- Install the legacy tiger geocoder stack only for PostGIS versions before 3.7. - -- fuzzystrmatch is required by postgis_tiger_geocoder, which PostGIS 3.7 and later no longer provide. - IF postgis_major < 3 OR (postgis_major = 3 AND postgis_minor < 7) THEN - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; - END IF; - END - $$; -EOSQL -done diff --git a/19rc1-3.6/update-postgis.sh b/19rc1-3.6/update-postgis.sh deleted file mode 100755 index 3e60e3983..000000000 --- a/19rc1-3.6/update-postgis.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB" "${@}"; do - echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" - psql --dbname="$DB" -c " - -- Upgrade PostGIS (includes raster) - CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; - - -- Upgrade Topology - CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; - " -done diff --git a/19rc1-3.7.0rc3/Dockerfile b/19rc1-3.7.0rc3/Dockerfile deleted file mode 100644 index 51881a02f..000000000 --- a/19rc1-3.7.0rc3/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ - # placeholder Dockerfile - # Debian version of postgis is not detected! - # This is an autogenerated message of ./update.sh diff --git a/19rc1-3.7.0rc3/alpine/Dockerfile b/19rc1-3.7.0rc3/alpine/Dockerfile deleted file mode 100644 index 1075a174c..000000000 --- a/19rc1-3.7.0rc3/alpine/Dockerfile +++ /dev/null @@ -1,147 +0,0 @@ -# -# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY. -# -ARG BASE_IMAGE=postgres:19rc1-alpine3.24 -FROM ${BASE_IMAGE} - -ARG NPROC= - -LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.7.0rc3 spatial database extension with PostgreSQL 19rc1 Alpine" \ - org.opencontainers.image.source="https://github.com/postgis/docker-postgis" - -ENV POSTGIS_VERSION=3.7.0rc3 -ENV POSTGIS_SHA256=77a63e7aa49665764974ddd3c904235ae344267452ce26e1ff7b6f048527dfd3 - -RUN set -eux \ - && apk add --no-cache --virtual .fetch-deps \ - ca-certificates \ - openssl \ - tar \ - \ - && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \ - && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/src/postgis \ - && tar \ - --extract \ - --file postgis.tar.gz \ - --directory /usr/src/postgis \ - --strip-components 1 \ - && rm postgis.tar.gz \ - \ - && apk add --no-cache --virtual .build-deps \ - \ - gdal-dev \ - geos-dev \ - gmp-dev \ - proj-dev \ - proj-util \ - sfcgal-dev \ - \ - # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains - # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL. - # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077 - $DOCKER_PG_LLVM_DEPS \ - \ - autoconf \ - automake \ - cunit-dev \ - file \ - g++ \ - gcc \ - gettext-dev \ - git \ - json-c-dev \ - libtool \ - libxml2-dev \ - make \ - pcre2-dev \ - perl \ - protobuf-c-dev \ - \ -# build PostGIS - with Link Time Optimization (LTO) enabled - && cd /usr/src/postgis \ - && gettextize \ - && ./autogen.sh \ - && ./configure \ - --enable-lto \ - && make -j${NPROC:-$(nproc)} \ - && make install \ - \ -# This section is for refreshing the proj data for the regression tests. -# It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316 -# This increases the Docker image size by about 1 MB. - && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \ - && projsync --system-directory --file us_noaa_eshpgn \ - && projsync --system-directory --file us_noaa_prvi \ - && projsync --system-directory --file us_noaa_wmhpgn \ -# This section performs a regression check. - && mkdir /tempdb \ - && chown -R postgres:postgres /tempdb \ - && su postgres -c 'pg_ctl -D /tempdb init' \ - && su postgres -c 'pg_ctl -D /tempdb -c -l /tmp/logfile -o '-F' start ' \ - && cd regress \ - && make -j${NPROC:-$(nproc)} check RUNTESTFLAGS="--extension --verbose" PGUSER=postgres \ - \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ - && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ - # Optional extensions: create them only if they are available. - # Since PostGIS 3.7.0rc, some builds may not include them. - # PostGIS 3.6.x still includes them. - # See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html - && su postgres -c "psql -v ON_ERROR_STOP=1 -c \" \ - DO \\\$\\\$ \ - DECLARE \ - extension_name text; \ - BEGIN \ - FOREACH extension_name IN ARRAY ARRAY[ \ - 'address_standardizer', \ - 'address_standardizer_data_us', \ - 'postgis_tiger_geocoder' \ - ] LOOP \ - IF EXISTS (SELECT 1 FROM pg_available_extensions WHERE name = extension_name) THEN \ - EXECUTE format('CREATE EXTENSION IF NOT EXISTS %I', extension_name); \ - ELSE \ - RAISE NOTICE 'Extension % is not available, skipping', extension_name; \ - END IF; \ - END LOOP; \ - END \ - \\\$\\\$;\"" \ - && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \ - && su postgres -c 'psql -t -c "\dx"' >> /_pgis_full_version.txt \ - \ - && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \ - && rm -rf /tempdb \ - && rm -rf /tmp/logfile \ - && rm -rf /tmp/pgis_reg \ -# add .postgis-rundeps - && apk add --no-cache --virtual .postgis-rundeps \ - \ - gdal \ - geos \ - gmp \ - proj \ - sfcgal \ - \ - json-c \ - libstdc++ \ - pcre2 \ - protobuf-c \ - \ - # ca-certificates: for accessing remote raster files - # fix https://github.com/postgis/docker-postgis/issues/307 - ca-certificates \ -# clean - && cd / \ - && rm -rf /usr/src/postgis \ - && apk del .fetch-deps .build-deps \ -# At the end of the build, we print the collected information -# from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes. - && cat /_pgis_full_version.txt - -COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh -COPY ./update-postgis.sh /usr/local/bin diff --git a/19rc1-3.7.0rc3/alpine/initdb-postgis.sh b/19rc1-3.7.0rc3/alpine/initdb-postgis.sh deleted file mode 100644 index ae56ee0ba..000000000 --- a/19rc1-3.7.0rc3/alpine/initdb-postgis.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -# Create the 'template_postgis' template db -"${psql[@]}" <<- 'EOSQL' -CREATE DATABASE template_postgis IS_TEMPLATE true; -EOSQL - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB"; do - echo "Loading PostGIS extensions into $DB" - "${psql[@]}" --dbname="$DB" <<-'EOSQL' - CREATE EXTENSION IF NOT EXISTS postgis; - CREATE EXTENSION IF NOT EXISTS postgis_topology; - -- Reconnect to update pg_setting.resetval - -- See https://github.com/postgis/docker-postgis/issues/288 - \c - -- - DO $$ - DECLARE - postgis_major integer; - postgis_minor integer; - BEGIN - SELECT substring(postgis_lib_version() from '^([0-9]+)')::integer, - substring(postgis_lib_version() from '^[0-9]+\.([0-9]+)')::integer - INTO postgis_major, postgis_minor; - - -- Install the legacy tiger geocoder stack only for PostGIS versions before 3.7. - -- fuzzystrmatch is required by postgis_tiger_geocoder, which PostGIS 3.7 and later no longer provide. - IF postgis_major < 3 OR (postgis_major = 3 AND postgis_minor < 7) THEN - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder; - END IF; - END - $$; -EOSQL -done diff --git a/19rc1-3.7.0rc3/alpine/update-postgis.sh b/19rc1-3.7.0rc3/alpine/update-postgis.sh deleted file mode 100755 index 3e60e3983..000000000 --- a/19rc1-3.7.0rc3/alpine/update-postgis.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -set -e - -# Perform all actions as $POSTGRES_USER -export PGUSER="$POSTGRES_USER" - -POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" - -# Load PostGIS into both template_database and $POSTGRES_DB -for DB in template_postgis "$POSTGRES_DB" "${@}"; do - echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" - psql --dbname="$DB" -c " - -- Upgrade PostGIS (includes raster) - CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION'; - - -- Upgrade Topology - CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; - " -done diff --git a/19rc1-3.6/Dockerfile b/19rc1-3.7/Dockerfile similarity index 90% rename from 19rc1-3.6/Dockerfile rename to 19rc1-3.7/Dockerfile index 0b694783a..423e4fe6c 100644 --- a/19rc1-3.6/Dockerfile +++ b/19rc1-3.7/Dockerfile @@ -5,11 +5,11 @@ FROM docker.io/postgres:19rc1-trixie LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4+dfsg-2.pgdg13+1 spatial database extension with PostgreSQL 19rc1 trixie" \ + org.opencontainers.image.description="PostGIS 3.7.0+dfsg-1.pgdg13+1 spatial database extension with PostgreSQL 19rc1 trixie" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" ENV POSTGIS_MAJOR=3 -ENV POSTGIS_VERSION=3.6.4+dfsg-2.pgdg13+1 +ENV POSTGIS_VERSION=3.7.0+dfsg-1.pgdg13+1 RUN apt-get update \ && apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \ diff --git a/19rc1-3.6/alpine/Dockerfile b/19rc1-3.7/alpine/Dockerfile similarity index 95% rename from 19rc1-3.6/alpine/Dockerfile rename to 19rc1-3.7/alpine/Dockerfile index 6d9785c44..2929cbb61 100644 --- a/19rc1-3.6/alpine/Dockerfile +++ b/19rc1-3.7/alpine/Dockerfile @@ -7,11 +7,11 @@ FROM ${BASE_IMAGE} ARG NPROC= LABEL maintainer="PostGIS Project - https://postgis.net" \ - org.opencontainers.image.description="PostGIS 3.6.4 spatial database extension with PostgreSQL 19rc1 Alpine" \ + org.opencontainers.image.description="PostGIS 3.7.0 spatial database extension with PostgreSQL 19rc1 Alpine" \ org.opencontainers.image.source="https://github.com/postgis/docker-postgis" -ENV POSTGIS_VERSION=3.6.4 -ENV POSTGIS_SHA256=4f80e1a4d227f088ae818f79180debd5894c075615823e0f556f73479cf1f200 +ENV POSTGIS_VERSION=3.7.0 +ENV POSTGIS_SHA256=306d68a115b88c59d9ffbd134b28fd1b0eccb7b0dabcbb5df2dc0b009d9de848 RUN set -eux \ && apk add --no-cache --virtual .fetch-deps \ @@ -89,7 +89,7 @@ RUN set -eux \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ # Optional extensions: create them only if they are available. - # Since PostGIS 3.7.0rc, some builds may not include them. + # Since PostGIS 3.7, some builds may not include them. # PostGIS 3.6.x still includes them. # See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html && su postgres -c "psql -v ON_ERROR_STOP=1 -c \" \ diff --git a/18-3.7.0rc3/alpine/initdb-postgis.sh b/19rc1-3.7/alpine/initdb-postgis.sh similarity index 100% rename from 18-3.7.0rc3/alpine/initdb-postgis.sh rename to 19rc1-3.7/alpine/initdb-postgis.sh diff --git a/18-3.7.0rc3/alpine/update-postgis.sh b/19rc1-3.7/alpine/update-postgis.sh similarity index 100% rename from 18-3.7.0rc3/alpine/update-postgis.sh rename to 19rc1-3.7/alpine/update-postgis.sh diff --git a/19rc1-3.6/alpine/initdb-postgis.sh b/19rc1-3.7/initdb-postgis.sh similarity index 100% rename from 19rc1-3.6/alpine/initdb-postgis.sh rename to 19rc1-3.7/initdb-postgis.sh diff --git a/19rc1-3.6/alpine/update-postgis.sh b/19rc1-3.7/update-postgis.sh similarity index 100% rename from 19rc1-3.6/alpine/update-postgis.sh rename to 19rc1-3.7/update-postgis.sh diff --git a/19rc1-master/Dockerfile b/19rc1-master/Dockerfile index 8521967e5..5f3bf9a0c 100644 --- a/19rc1-master/Dockerfile +++ b/19rc1-master/Dockerfile @@ -114,7 +114,7 @@ RUN set -ex \ # CGAL and SFCGAL. ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=e13f4e9be9def5a9f670adfa799463948796091c +ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 RUN set -ex \ && mkdir -p /usr/src \ @@ -182,7 +182,7 @@ RUN set -ex \ && rm -fr /usr/src/PROJ # GEOS. -ENV GEOS_GIT_HASH=283e82726fbd5ecc45397f182e12e056a65b2dd7 +ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c RUN set -ex \ && cd /usr/src \ && git clone https://github.com/libgeos/geos.git \ @@ -198,7 +198,7 @@ RUN set -ex \ && rm -fr /usr/src/geos # GDAL. -ENV GDAL_GIT_HASH=940f7198429fc578694b108631dfe5afd77efd2f +ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/gdal.git \ @@ -345,11 +345,11 @@ COPY --from=builder /usr/local /usr/local ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=e13f4e9be9def5a9f670adfa799463948796091c +ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 -ENV GEOS_GIT_HASH=283e82726fbd5ecc45397f182e12e056a65b2dd7 -ENV GDAL_GIT_HASH=940f7198429fc578694b108631dfe5afd77efd2f +ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c +ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 # Minimal command-line smoke test (fail fast). RUN set -ex \ @@ -368,7 +368,7 @@ RUN set -ex \ || echo "ogr2ogr missing PostgreSQL driver" && exit 1 # Install PostGIS and companion development extensions. -ENV POSTGIS_GIT_HASH=4db4d8050012b7a84e70ed11629bbc71daa20b6e +ENV POSTGIS_GIT_HASH=358ee965988ba72ecd47601205c99b9e91cc037e ENV H3_PG_GIT_HASH=f960a574eab6aebd186dedff6204711c21742f12 ENV ADDRESS_STANDARDIZER_GIT_HASH=ba9a26a013f23908657bb26574ae436b11d4b811 diff --git a/Dockerfile.alpine.template b/Dockerfile.alpine.template index d68822a92..02062068b 100644 --- a/Dockerfile.alpine.template +++ b/Dockerfile.alpine.template @@ -89,7 +89,7 @@ RUN set -eux \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_topology;"' \ # Optional extensions: create them only if they are available. - # Since PostGIS 3.7.0rc, some builds may not include them. + # Since PostGIS 3.7, some builds may not include them. # PostGIS 3.6.x still includes them. # See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html && su postgres -c "psql -v ON_ERROR_STOP=1 -c \" \ diff --git a/Makefile b/Makefile index 3c0a5ce8f..3b8a1a8b2 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # When processing the rules for tagging and pushing container images with the # "latest" tag, the following variable will be the version that is considered # to be the latest. -LATEST_VERSION=18-3.6 +LATEST_VERSION=18-3.7 # The following flags are set based on VERSION and VARIANT environment variables # that may have been specified, and are used by rules to determine which diff --git a/README.md b/README.md index 3bdabe61e..0f0d059ee 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,15 @@ [![Build Status](https://github.com/postgis/docker-postgis/workflows/Docker%20PostGIS%20CI/badge.svg)](https://github.com/postgis/docker-postgis/actions) [![Join the chat at https://gitter.im/postgis/docker-postgis](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/postgis/docker-postgis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) > [!WARNING] -> **Breaking change (2026-10):** Debian images moved to **trixie** with PostGIS **3.6**; `*-3.5` tags are no longer updated. -> Upgrading from `*-3.5` (bullseye) to `*-3.6` (trixie) also changes the OS and glibc version, which can corrupt text indexes. +> **Breaking change (2026-10):** Debian images moved to **trixie** with PostGIS **3.7**; `*-3.5` and `*-3.6` tags are no longer updated. +> Upgrading from `*-3.5` (bullseye) to `*-3.7` (trixie) also changes the OS and glibc version, which can corrupt text indexes. > **The safest way is a full `pg_dump` and `pg_restore` into a new database!** +> PostGIS 3.7 no longer provides the `postgis_tiger_geocoder` and `address_standardizer` extensions; check your databases before upgrading from `*-3.6`. **⚠️ Breaking change (PostgreSQL 18+):** Default `VOLUME` path changed to `/var/lib/postgresql` -The `postgis/postgis` image provides tags for running Postgres with [PostGIS](http://postgis.net/) extensions installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides Debian and Alpine variants for PostGIS 3.6.x, compatible with PostgreSQL 14, 15, 16, 17 and 18. Test images are also provided for PostgreSQL 19 pre-releases, PostGIS 3.7 release candidates, and builds from the PostGIS/GEOS/PROJ/GDAL master branches (`*-master`). +The `postgis/postgis` image provides tags for running Postgres with [PostGIS](http://postgis.net/) extensions installed. This image is based on the official [`postgres`](https://registry.hub.docker.com/_/postgres/) image and provides Debian and Alpine variants for PostGIS 3.7.x, compatible with PostgreSQL 14, 15, 16, 17 and 18. Test images are also provided for PostgreSQL 19 pre-releases and builds from the PostGIS/GEOS/PROJ/GDAL master branches (`*-master`). This image ensures that the default database created by the parent `postgres` image will have the following extensions installed: @@ -18,23 +19,20 @@ This image ensures that the default database created by the parent `postgres` im |--------------------------|-----| | `postgis` | yes | | `postgis_topology` | yes | -| `postgis_tiger_geocoder` | yes, for PostGIS < 3.7 | | `postgis_raster` | no (available) | | `postgis_sfcgal` | no (available) | -| `address_standardizer`| no (available) | -| `address_standardizer_data_us`| no (available) | -For PostGIS 3.6 images, `address_standardizer` and `address_standardizer_data_us` are available from the PostGIS package but are not initialized by default. Starting with PostGIS 3.7, `address_standardizer` and `postgis_tiger_geocoder` are no longer provided by PostGIS. The `*-master` images install `address_standardizer` separately from https://github.com/postgis/address_standardizer (and `h3` from https://github.com/postgis/h3-pg), while the PostGIS 3.7 release candidate images (`*-3.7.0rcN-alpine`) include neither `postgis_tiger_geocoder`, nor `address_standardizer`, nor `h3`. +Starting with PostGIS 3.7, `address_standardizer` and `postgis_tiger_geocoder` are no longer provided by PostGIS, so the `*-3.7` images include neither of them (nor `h3`). The `*-master` images install `address_standardizer` separately from https://github.com/postgis/address_standardizer (and `h3` from https://github.com/postgis/h3-pg); these are available but not initialized by default. Unless `-e POSTGRES_DB` is passed to the container at startup time, this database will be named after the admin user (either `postgres` or the user specified with `-e POSTGRES_USER`). If you would prefer to use the older template database mechanism for enabling PostGIS, the image also provides a PostGIS-enabled template database called `template_postgis`. -## Versions (2026-10-21) +## Versions (2026-10-31) Supported architecture: `amd64` (x86-64) Recommended version for new users: -* `postgis/postgis:18-3.6` +* `postgis/postgis:18-3.7` * ⚠️ Uses `VOLUME` path `/var/lib/postgresql` (changed in PostgreSQL 18+) ### Debian based (recommended) @@ -53,11 +51,11 @@ Recommended version for new users: | DockerHub image | Dockerfile | OS | Postgres | PostGIS | | --------------- | ---------- | -- | -------- | ------- | -| [postgis/postgis:14-3.6](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=14-3.6) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/14-3.6/Dockerfile) | debian:trixie | 14 | 3.6.4 | -| [postgis/postgis:15-3.6](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=15-3.6) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/15-3.6/Dockerfile) | debian:trixie | 15 | 3.6.4 | -| [postgis/postgis:16-3.6](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=16-3.6) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/16-3.6/Dockerfile) | debian:trixie | 16 | 3.6.4 | -| [postgis/postgis:17-3.6](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=17-3.6) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/17-3.6/Dockerfile) | debian:trixie | 17 | 3.6.4 | -| [postgis/postgis:18-3.6](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=18-3.6) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/18-3.6/Dockerfile) | debian:trixie | 18 | 3.6.4 | +| [postgis/postgis:14-3.7](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=14-3.7) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/14-3.7/Dockerfile) | debian:trixie | 14 | 3.7.0 | +| [postgis/postgis:15-3.7](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=15-3.7) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/15-3.7/Dockerfile) | debian:trixie | 15 | 3.7.0 | +| [postgis/postgis:16-3.7](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=16-3.7) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/16-3.7/Dockerfile) | debian:trixie | 16 | 3.7.0 | +| [postgis/postgis:17-3.7](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=17-3.7) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/17-3.7/Dockerfile) | debian:trixie | 17 | 3.7.0 | +| [postgis/postgis:18-3.7](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=18-3.7) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/18-3.7/Dockerfile) | debian:trixie | 18 | 3.7.0 | ### Alpine based @@ -74,19 +72,19 @@ Recommended version for new users: | DockerHub image | Dockerfile | OS | Postgres | PostGIS | | --------------- | ---------- | -- | -------- | ------- | -| [postgis/postgis:14-3.6-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=14-3.6-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/14-3.6/alpine/Dockerfile) | alpine:3.24 | 14 | 3.6.4 | -| [postgis/postgis:15-3.6-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=15-3.6-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/15-3.6/alpine/Dockerfile) | alpine:3.24 | 15 | 3.6.4 | -| [postgis/postgis:16-3.6-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=16-3.6-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/16-3.6/alpine/Dockerfile) | alpine:3.24 | 16 | 3.6.4 | -| [postgis/postgis:17-3.6-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=17-3.6-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/17-3.6/alpine/Dockerfile) | alpine:3.24 | 17 | 3.6.4 | -| [postgis/postgis:18-3.6-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=18-3.6-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/18-3.6/alpine/Dockerfile) | alpine:3.24 | 18 | 3.6.4 | +| [postgis/postgis:14-3.7-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=14-3.7-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/14-3.7/alpine/Dockerfile) | alpine:3.24 | 14 | 3.7.0 | +| [postgis/postgis:15-3.7-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=15-3.7-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/15-3.7/alpine/Dockerfile) | alpine:3.24 | 15 | 3.7.0 | +| [postgis/postgis:16-3.7-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=16-3.7-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/16-3.7/alpine/Dockerfile) | alpine:3.24 | 16 | 3.7.0 | +| [postgis/postgis:17-3.7-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=17-3.7-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/17-3.7/alpine/Dockerfile) | alpine:3.24 | 17 | 3.7.0 | +| [postgis/postgis:18-3.7-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=18-3.7-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/18-3.7/alpine/Dockerfile) | alpine:3.24 | 18 | 3.7.0 | ### Test images * We provide alpha, beta, release candidate (rc), and development (identified as ~master) versions. * For `*-master` images, the template is updated manually, which might lead to a delay of a few weeks sometimes. -* Current PostGIS 3.7 development images use the up-to-date CGAL revision from the `6.2.x-branch`. -* Starting with PostGIS >= 3.7, PostGIS itself no longer includes the `address_standardizer` and `postgis_tiger_geocoder` extensions. The `*-master` images install `address_standardizer` separately from https://github.com/postgis/address_standardizer and run its upstream-style installcheck. See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html +* Current PostGIS development (`*-master`) images use the up-to-date CGAL revision from the `6.2.x-branch`. +* Since PostGIS 3.7, PostGIS itself no longer includes the `address_standardizer` and `postgis_tiger_geocoder` extensions. The `*-master` images install `address_standardizer` separately from https://github.com/postgis/address_standardizer and run its upstream-style installcheck. See: https://lists.osgeo.org/pipermail/postgis-devel/2026-February/030730.html * They also install the `h3` and `h3_postgis` extensions from the `main` branch of https://github.com/postgis/h3-pg; because this is a development branch, their extension version may appear as `unreleased`. @@ -95,11 +93,9 @@ Recommended version for new users: | --------------- | ---------- | -- | -------- | ------- | | [postgis/postgis:16-master](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=16-master) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/16-master/Dockerfile) | debian:trixie | 16 | development: postgis, geos, proj, gdal | | [postgis/postgis:17-master](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=17-master) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/17-master/Dockerfile) | debian:trixie | 17 | development: postgis, geos, proj, gdal | -| [postgis/postgis:18-3.7.0rc3-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=18-3.7.0rc3-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/18-3.7.0rc3/alpine/Dockerfile) | alpine:3.24 | 18 | 3.7.0rc3 | | [postgis/postgis:18-master](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=18-master) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/18-master/Dockerfile) | debian:trixie | 18 | development: postgis, geos, proj, gdal | -| [postgis/postgis:19rc1-3.6](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=19rc1-3.6) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/19rc1-3.6/Dockerfile) | debian:trixie | 19rc1 | 3.6.4 | -| [postgis/postgis:19rc1-3.6-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=19rc1-3.6-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/19rc1-3.6/alpine/Dockerfile) | alpine:3.24 | 19rc1 | 3.6.4 | -| [postgis/postgis:19rc1-3.7.0rc3-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=19rc1-3.7.0rc3-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/19rc1-3.7.0rc3/alpine/Dockerfile) | alpine:3.24 | 19rc1 | 3.7.0rc3 | +| [postgis/postgis:19rc1-3.7](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=19rc1-3.7) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/19rc1-3.7/Dockerfile) | debian:trixie | 19rc1 | 3.7.0 | +| [postgis/postgis:19rc1-3.7-alpine](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=19rc1-3.7-alpine) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/19rc1-3.7/alpine/Dockerfile) | alpine:3.24 | 19rc1 | 3.7.0 | | [postgis/postgis:19rc1-master](https://registry.hub.docker.com/r/postgis/postgis/tags?page=1&name=19rc1-master) | [Dockerfile](https://github.com/postgis/docker-postgis/blob/master/19rc1-master/Dockerfile) | debian:trixie | 19rc1 | development: postgis, geos, proj, gdal | @@ -226,7 +222,7 @@ For more specific issues related to the Postgres Docker image, you can search us * Optimizing Security Scans: It's advisable to focus on scanning and fixing issues that can be resolved. Use this command to scan for fixable issues only: - * `trivy image --ignore-unfixed postgis/postgis:18-3.6-alpine` + * `trivy image --ignore-unfixed postgis/postgis:18-3.7-alpine` * `trivy image --ignore-unfixed postgres:18-alpine` For more details, you can read [this article](https://pythonspeed.com/articles/docker-security-scanner/) From 77282420880580beb3787cf28d8f800e43339b9b Mon Sep 17 00:00:00 2001 From: ImreSamu Date: Thu, 5 Nov 2026 00:37:58 +0100 Subject: [PATCH 2/2] fix update-postgis.sh --- 14-3.7/alpine/update-postgis.sh | 36 ++++++++++++-- 14-3.7/update-postgis.sh | 36 ++++++++++++-- 15-3.7/alpine/update-postgis.sh | 36 ++++++++++++-- 15-3.7/update-postgis.sh | 36 ++++++++++++-- 16-3.7/alpine/update-postgis.sh | 36 ++++++++++++-- 16-3.7/update-postgis.sh | 36 ++++++++++++-- 16-master/Dockerfile | 18 +++---- 16-master/update-postgis.sh | 36 ++++++++++++-- 17-3.7/alpine/update-postgis.sh | 36 ++++++++++++-- 17-3.7/update-postgis.sh | 36 ++++++++++++-- 17-master/Dockerfile | 18 +++---- 17-master/update-postgis.sh | 36 ++++++++++++-- 18-3.7/alpine/update-postgis.sh | 36 ++++++++++++-- 18-3.7/update-postgis.sh | 36 ++++++++++++-- 18-master/Dockerfile | 18 +++---- 18-master/update-postgis.sh | 36 ++++++++++++-- 19rc1-3.7/alpine/update-postgis.sh | 36 ++++++++++++-- 19rc1-3.7/update-postgis.sh | 36 ++++++++++++-- 19rc1-master/Dockerfile | 18 +++---- 19rc1-master/update-postgis.sh | 36 ++++++++++++-- README.md | 2 +- test/postgis-config.sh | 1 + test/tests/postgis-basics/run.sh | 1 + test/tests/postgis-update/run.sh | 78 ++++++++++++++++++++++++++++++ update-postgis.sh | 36 ++++++++++++-- 25 files changed, 644 insertions(+), 122 deletions(-) create mode 100755 test/tests/postgis-update/run.sh diff --git a/14-3.7/alpine/update-postgis.sh b/14-3.7/alpine/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/14-3.7/alpine/update-postgis.sh +++ b/14-3.7/alpine/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/14-3.7/update-postgis.sh b/14-3.7/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/14-3.7/update-postgis.sh +++ b/14-3.7/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/15-3.7/alpine/update-postgis.sh b/15-3.7/alpine/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/15-3.7/alpine/update-postgis.sh +++ b/15-3.7/alpine/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/15-3.7/update-postgis.sh b/15-3.7/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/15-3.7/update-postgis.sh +++ b/15-3.7/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/16-3.7/alpine/update-postgis.sh b/16-3.7/alpine/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/16-3.7/alpine/update-postgis.sh +++ b/16-3.7/alpine/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/16-3.7/update-postgis.sh b/16-3.7/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/16-3.7/update-postgis.sh +++ b/16-3.7/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/16-master/Dockerfile b/16-master/Dockerfile index 846e22f2a..3a1fd4c15 100644 --- a/16-master/Dockerfile +++ b/16-master/Dockerfile @@ -114,7 +114,7 @@ RUN set -ex \ # CGAL and SFCGAL. ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 +ENV CGAL_GIT_HASH=ffd0b3a7d7dcc53ed260d513df01a9f7b7c2ae33 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 RUN set -ex \ && mkdir -p /usr/src \ @@ -149,7 +149,7 @@ RUN set -ex \ && rm -fr /usr/src/cgal # PROJ. -ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 +ENV PROJ_GIT_HASH=294069aa3e068036e30c6d0346949084db5d48d3 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/PROJ.git \ @@ -182,7 +182,7 @@ RUN set -ex \ && rm -fr /usr/src/PROJ # GEOS. -ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c +ENV GEOS_GIT_HASH=8bace6161f6593643e45875d7972247699357720 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/libgeos/geos.git \ @@ -198,7 +198,7 @@ RUN set -ex \ && rm -fr /usr/src/geos # GDAL. -ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 +ENV GDAL_GIT_HASH=fa1fc3c77e75787c614e12a2ba5ac366db833e1f RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/gdal.git \ @@ -345,11 +345,11 @@ COPY --from=builder /usr/local /usr/local ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 +ENV CGAL_GIT_HASH=ffd0b3a7d7dcc53ed260d513df01a9f7b7c2ae33 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 -ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 -ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c -ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 +ENV PROJ_GIT_HASH=294069aa3e068036e30c6d0346949084db5d48d3 +ENV GEOS_GIT_HASH=8bace6161f6593643e45875d7972247699357720 +ENV GDAL_GIT_HASH=fa1fc3c77e75787c614e12a2ba5ac366db833e1f # Minimal command-line smoke test (fail fast). RUN set -ex \ @@ -368,7 +368,7 @@ RUN set -ex \ || echo "ogr2ogr missing PostgreSQL driver" && exit 1 # Install PostGIS and companion development extensions. -ENV POSTGIS_GIT_HASH=358ee965988ba72ecd47601205c99b9e91cc037e +ENV POSTGIS_GIT_HASH=625d3e52118717383edff7b3b94026e706ae4e98 ENV H3_PG_GIT_HASH=f960a574eab6aebd186dedff6204711c21742f12 ENV ADDRESS_STANDARDIZER_GIT_HASH=ba9a26a013f23908657bb26574ae436b11d4b811 diff --git a/16-master/update-postgis.sh b/16-master/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/16-master/update-postgis.sh +++ b/16-master/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/17-3.7/alpine/update-postgis.sh b/17-3.7/alpine/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/17-3.7/alpine/update-postgis.sh +++ b/17-3.7/alpine/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/17-3.7/update-postgis.sh b/17-3.7/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/17-3.7/update-postgis.sh +++ b/17-3.7/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/17-master/Dockerfile b/17-master/Dockerfile index d2d4dcd58..9620b4abc 100644 --- a/17-master/Dockerfile +++ b/17-master/Dockerfile @@ -114,7 +114,7 @@ RUN set -ex \ # CGAL and SFCGAL. ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 +ENV CGAL_GIT_HASH=ffd0b3a7d7dcc53ed260d513df01a9f7b7c2ae33 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 RUN set -ex \ && mkdir -p /usr/src \ @@ -149,7 +149,7 @@ RUN set -ex \ && rm -fr /usr/src/cgal # PROJ. -ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 +ENV PROJ_GIT_HASH=294069aa3e068036e30c6d0346949084db5d48d3 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/PROJ.git \ @@ -182,7 +182,7 @@ RUN set -ex \ && rm -fr /usr/src/PROJ # GEOS. -ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c +ENV GEOS_GIT_HASH=8bace6161f6593643e45875d7972247699357720 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/libgeos/geos.git \ @@ -198,7 +198,7 @@ RUN set -ex \ && rm -fr /usr/src/geos # GDAL. -ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 +ENV GDAL_GIT_HASH=fa1fc3c77e75787c614e12a2ba5ac366db833e1f RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/gdal.git \ @@ -345,11 +345,11 @@ COPY --from=builder /usr/local /usr/local ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 +ENV CGAL_GIT_HASH=ffd0b3a7d7dcc53ed260d513df01a9f7b7c2ae33 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 -ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 -ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c -ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 +ENV PROJ_GIT_HASH=294069aa3e068036e30c6d0346949084db5d48d3 +ENV GEOS_GIT_HASH=8bace6161f6593643e45875d7972247699357720 +ENV GDAL_GIT_HASH=fa1fc3c77e75787c614e12a2ba5ac366db833e1f # Minimal command-line smoke test (fail fast). RUN set -ex \ @@ -368,7 +368,7 @@ RUN set -ex \ || echo "ogr2ogr missing PostgreSQL driver" && exit 1 # Install PostGIS and companion development extensions. -ENV POSTGIS_GIT_HASH=358ee965988ba72ecd47601205c99b9e91cc037e +ENV POSTGIS_GIT_HASH=625d3e52118717383edff7b3b94026e706ae4e98 ENV H3_PG_GIT_HASH=f960a574eab6aebd186dedff6204711c21742f12 ENV ADDRESS_STANDARDIZER_GIT_HASH=ba9a26a013f23908657bb26574ae436b11d4b811 diff --git a/17-master/update-postgis.sh b/17-master/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/17-master/update-postgis.sh +++ b/17-master/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/18-3.7/alpine/update-postgis.sh b/18-3.7/alpine/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/18-3.7/alpine/update-postgis.sh +++ b/18-3.7/alpine/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/18-3.7/update-postgis.sh b/18-3.7/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/18-3.7/update-postgis.sh +++ b/18-3.7/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/18-master/Dockerfile b/18-master/Dockerfile index 5d1354bf1..e152ce9fc 100644 --- a/18-master/Dockerfile +++ b/18-master/Dockerfile @@ -114,7 +114,7 @@ RUN set -ex \ # CGAL and SFCGAL. ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 +ENV CGAL_GIT_HASH=ffd0b3a7d7dcc53ed260d513df01a9f7b7c2ae33 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 RUN set -ex \ && mkdir -p /usr/src \ @@ -149,7 +149,7 @@ RUN set -ex \ && rm -fr /usr/src/cgal # PROJ. -ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 +ENV PROJ_GIT_HASH=294069aa3e068036e30c6d0346949084db5d48d3 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/PROJ.git \ @@ -182,7 +182,7 @@ RUN set -ex \ && rm -fr /usr/src/PROJ # GEOS. -ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c +ENV GEOS_GIT_HASH=8bace6161f6593643e45875d7972247699357720 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/libgeos/geos.git \ @@ -198,7 +198,7 @@ RUN set -ex \ && rm -fr /usr/src/geos # GDAL. -ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 +ENV GDAL_GIT_HASH=fa1fc3c77e75787c614e12a2ba5ac366db833e1f RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/gdal.git \ @@ -345,11 +345,11 @@ COPY --from=builder /usr/local /usr/local ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 +ENV CGAL_GIT_HASH=ffd0b3a7d7dcc53ed260d513df01a9f7b7c2ae33 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 -ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 -ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c -ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 +ENV PROJ_GIT_HASH=294069aa3e068036e30c6d0346949084db5d48d3 +ENV GEOS_GIT_HASH=8bace6161f6593643e45875d7972247699357720 +ENV GDAL_GIT_HASH=fa1fc3c77e75787c614e12a2ba5ac366db833e1f # Minimal command-line smoke test (fail fast). RUN set -ex \ @@ -368,7 +368,7 @@ RUN set -ex \ || echo "ogr2ogr missing PostgreSQL driver" && exit 1 # Install PostGIS and companion development extensions. -ENV POSTGIS_GIT_HASH=358ee965988ba72ecd47601205c99b9e91cc037e +ENV POSTGIS_GIT_HASH=625d3e52118717383edff7b3b94026e706ae4e98 ENV H3_PG_GIT_HASH=f960a574eab6aebd186dedff6204711c21742f12 ENV ADDRESS_STANDARDIZER_GIT_HASH=ba9a26a013f23908657bb26574ae436b11d4b811 diff --git a/18-master/update-postgis.sh b/18-master/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/18-master/update-postgis.sh +++ b/18-master/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/19rc1-3.7/alpine/update-postgis.sh b/19rc1-3.7/alpine/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/19rc1-3.7/alpine/update-postgis.sh +++ b/19rc1-3.7/alpine/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/19rc1-3.7/update-postgis.sh b/19rc1-3.7/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/19rc1-3.7/update-postgis.sh +++ b/19rc1-3.7/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/19rc1-master/Dockerfile b/19rc1-master/Dockerfile index 5f3bf9a0c..3f55d8d27 100644 --- a/19rc1-master/Dockerfile +++ b/19rc1-master/Dockerfile @@ -114,7 +114,7 @@ RUN set -ex \ # CGAL and SFCGAL. ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 +ENV CGAL_GIT_HASH=ffd0b3a7d7dcc53ed260d513df01a9f7b7c2ae33 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 RUN set -ex \ && mkdir -p /usr/src \ @@ -149,7 +149,7 @@ RUN set -ex \ && rm -fr /usr/src/cgal # PROJ. -ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 +ENV PROJ_GIT_HASH=294069aa3e068036e30c6d0346949084db5d48d3 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/PROJ.git \ @@ -182,7 +182,7 @@ RUN set -ex \ && rm -fr /usr/src/PROJ # GEOS. -ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c +ENV GEOS_GIT_HASH=8bace6161f6593643e45875d7972247699357720 RUN set -ex \ && cd /usr/src \ && git clone https://github.com/libgeos/geos.git \ @@ -198,7 +198,7 @@ RUN set -ex \ && rm -fr /usr/src/geos # GDAL. -ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 +ENV GDAL_GIT_HASH=fa1fc3c77e75787c614e12a2ba5ac366db833e1f RUN set -ex \ && cd /usr/src \ && git clone https://github.com/OSGeo/gdal.git \ @@ -345,11 +345,11 @@ COPY --from=builder /usr/local /usr/local ARG CGAL_GIT_BRANCH ENV CGAL_GIT_BRANCH=${CGAL_GIT_BRANCH} -ENV CGAL_GIT_HASH=653712bb5c1507b24a65677c931eda50c1f9b726 +ENV CGAL_GIT_HASH=ffd0b3a7d7dcc53ed260d513df01a9f7b7c2ae33 ENV SFCGAL_GIT_HASH=ac4942f2ef2ea201533586e4efe47b04afc64f77 -ENV PROJ_GIT_HASH=5fa31c29f0a806568ed7bc76c1a557604db4a804 -ENV GEOS_GIT_HASH=2289bad7aac673a1bffcbbdd96944fcc57405a9c -ENV GDAL_GIT_HASH=5d190fda3d58bee3e39176693b1deed7ec6238d4 +ENV PROJ_GIT_HASH=294069aa3e068036e30c6d0346949084db5d48d3 +ENV GEOS_GIT_HASH=8bace6161f6593643e45875d7972247699357720 +ENV GDAL_GIT_HASH=fa1fc3c77e75787c614e12a2ba5ac366db833e1f # Minimal command-line smoke test (fail fast). RUN set -ex \ @@ -368,7 +368,7 @@ RUN set -ex \ || echo "ogr2ogr missing PostgreSQL driver" && exit 1 # Install PostGIS and companion development extensions. -ENV POSTGIS_GIT_HASH=358ee965988ba72ecd47601205c99b9e91cc037e +ENV POSTGIS_GIT_HASH=625d3e52118717383edff7b3b94026e706ae4e98 ENV H3_PG_GIT_HASH=f960a574eab6aebd186dedff6204711c21742f12 ENV ADDRESS_STANDARDIZER_GIT_HASH=ba9a26a013f23908657bb26574ae436b11d4b811 diff --git a/19rc1-master/update-postgis.sh b/19rc1-master/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/19rc1-master/update-postgis.sh +++ b/19rc1-master/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done diff --git a/README.md b/README.md index 0f0d059ee..2d67b69be 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Starting with PostGIS 3.7, `address_standardizer` and `postgis_tiger_geocoder` a Unless `-e POSTGRES_DB` is passed to the container at startup time, this database will be named after the admin user (either `postgres` or the user specified with `-e POSTGRES_USER`). If you would prefer to use the older template database mechanism for enabling PostGIS, the image also provides a PostGIS-enabled template database called `template_postgis`. -## Versions (2026-10-31) +## Versions (2026-11-05) Supported architecture: `amd64` (x86-64) diff --git a/test/postgis-config.sh b/test/postgis-config.sh index 39027796a..cd541132c 100644 --- a/test/postgis-config.sh +++ b/test/postgis-config.sh @@ -2,4 +2,5 @@ testAlias[postgis/postgis]=postgres imageTests[postgis/postgis]=' postgis-basics + postgis-update ' diff --git a/test/tests/postgis-basics/run.sh b/test/tests/postgis-basics/run.sh index 6cfc804da..40577a608 100755 --- a/test/tests/postgis-basics/run.sh +++ b/test/tests/postgis-basics/run.sh @@ -20,6 +20,7 @@ psql() { --host postgis \ --username "$POSTGRES_USER" \ --dbname "$POSTGRES_DB" \ + -v ON_ERROR_STOP=1 \ --quiet --no-align --tuples-only \ "$@" } diff --git a/test/tests/postgis-update/run.sh b/test/tests/postgis-update/run.sh new file mode 100755 index 000000000..ec787f3c3 --- /dev/null +++ b/test/tests/postgis-update/run.sh @@ -0,0 +1,78 @@ +#!/bin/bash +set -e + +image="$1" + +export POSTGRES_USER='my cool postgres user' +export POSTGRES_PASSWORD='my cool postgres password' +export POSTGRES_DB='my cool postgres database' + +cname="postgis-container-$RANDOM-$RANDOM" +cid="$(docker run -d -e POSTGRES_USER -e POSTGRES_PASSWORD -e POSTGRES_DB --name "$cname" "$image")" +trap "docker rm -vf $cid > /dev/null" EXIT + +psql() { + docker run --rm -i \ + --link "$cname":postgis \ + --entrypoint psql \ + -e PGPASSWORD="$POSTGRES_PASSWORD" \ + "$image" \ + --host postgis \ + --username "$POSTGRES_USER" \ + --dbname "$POSTGRES_DB" \ + -v ON_ERROR_STOP=1 \ + --quiet --no-align --tuples-only \ + "$@" +} + +tries=10 +while ! echo 'SELECT 1' | psql &> /dev/null; do + (( tries-- )) + if [ $tries -le 0 ]; then + echo >&2 'postgres failed to accept connections in a reasonable amount of time!' + echo 'SELECT 1' | psql # to hopefully get a useful error message + false + fi + sleep 2 +done + +# Run twice: update-postgis.sh must be idempotent. +docker exec "$cid" update-postgis.sh +docker exec "$cid" update-postgis.sh + +## test postgis extensions are at the version provided by the image +outdated="$( + psql <<-'EOSQL' + SELECT name + FROM pg_available_extensions + WHERE name IN ('postgis', 'postgis_topology') + AND installed_version IS DISTINCT FROM default_version; + EOSQL +)" +if [ -n "$outdated" ]; then + echo >&2 "extensions not updated: $outdated" + exit 1 +fi + +## test postgis_tiger_geocoder extension +# PostGIS versions before 3.7 are expected to provide it, later versions don't. +tiger_state="$( + psql <<-'EOSQL' + SELECT CASE + WHEN (postgis_major < 3 OR (postgis_major = 3 AND postgis_minor < 7)) = installed THEN 'ok' + WHEN installed THEN 'unexpected' + ELSE 'missing' + END + FROM ( + SELECT substring(postgis_lib_version() from '^([0-9]+)')::integer AS postgis_major, + substring(postgis_lib_version() from '^[0-9]+\.([0-9]+)')::integer AS postgis_minor, + EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'postgis_tiger_geocoder') AS installed + ) AS postgis_version; + EOSQL +)" +if [ "$tiger_state" != ok ]; then + echo >&2 "postgis_tiger_geocoder extension test failed: $tiger_state" + exit 1 +fi + +echo "update-postgis.sh works!" diff --git a/update-postgis.sh b/update-postgis.sh index 3e60e3983..a5d99bd69 100755 --- a/update-postgis.sh +++ b/update-postgis.sh @@ -7,6 +7,11 @@ export PGUSER="$POSTGRES_USER" POSTGIS_VERSION="${POSTGIS_VERSION%%+*}" +# The *-master images do not set POSTGIS_VERSION, use the version they provide +if [ -z "$POSTGIS_VERSION" ]; then + POSTGIS_VERSION="$(psql --dbname=template1 -Atc "SELECT default_version FROM pg_available_extensions WHERE name = 'postgis'")" +fi + # Load PostGIS into both template_database and $POSTGRES_DB for DB in template_postgis "$POSTGRES_DB" "${@}"; do echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION" @@ -19,10 +24,31 @@ for DB in template_postgis "$POSTGRES_DB" "${@}"; do CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION'; ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION'; - -- Install Tiger dependencies in case not already installed - CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; - -- Upgrade US Tiger Geocoder - CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; - ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + DO \$\$ + DECLARE + orphan text; + BEGIN + -- PostGIS 3.7 and later no longer provide the US Tiger Geocoder + IF EXISTS ( + SELECT FROM pg_available_extension_versions + WHERE name = 'postgis_tiger_geocoder' AND version = '$POSTGIS_VERSION' + ) THEN + -- Install Tiger dependencies in case not already installed + CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; + -- Upgrade US Tiger Geocoder + CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION'; + ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION'; + END IF; + + -- Installed earlier, but this image can no longer upgrade them + FOR orphan IN + SELECT e.extname FROM pg_extension e + WHERE e.extname IN ('postgis_tiger_geocoder', 'address_standardizer', 'address_standardizer_data_us') + AND NOT EXISTS (SELECT FROM pg_available_extensions a WHERE a.name = e.extname) + LOOP + RAISE WARNING 'extension \"%\" is installed in database \"%\", but this image does not provide it: not upgraded', orphan, current_database(); + END LOOP; + END + \$\$; " done