Skip to content

Commit dabd4d3

Browse files
authored
add postgis/postgis:14beta2-3.1 versions (#249)
* add 14beta2 update scripts - No "postgres:14" images; only "postgres:14beta2" and "postgres:14beta2-alpine" so I have made some quick&dirty changes The Postgres-betas internal format can be change; so the new tagging is better for the users. typical error: "The database cluster was initialized with CATALOG_VERSION_NO" related: #228 - I have updated some upstream master to main. * add 14beta2-3.1/* files ; generated by ./update.sh * Manual update the alpine files to 3.1.3 The debain version is still on 3.1.2 ; but this unmodified version is not working with beta2 see: https://postgis.net/2021/07/02/postgis-3.1.3/ * add updated (12|13)-master Dockerfiles
1 parent 39ec46f commit dabd4d3

File tree

11 files changed

+318
-22
lines changed

11 files changed

+318
-22
lines changed

.github/workflows/main.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ defaults:
1111
shell: bash
1212

1313
jobs:
14-
14+
1515
make-docker-images:
1616
strategy:
1717
matrix:
18-
postgres: [9.6, 10, 11, 12, 13]
18+
postgres: [9.6, 10, 11, 12, 13, '14beta2']
1919
postgis: ['2.5', '3.1']
2020
variant: [default, alpine]
2121
exclude:
2222
- postgres: 13
2323
postgis: '2.5'
24+
- postgres: '14beta2'
25+
postgis: '2.5'
2426
include:
2527
- postgres: 12
2628
postgis: master

12-master/Dockerfile

+7-7
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ RUN set -ex \
7979

8080
# proj
8181
ENV PROJ_VERSION master
82-
ENV PROJ_GIT_HASH d41c10c9e1e787a521a3841605a2e6024649eb3f
82+
ENV PROJ_GIT_HASH d902272785a55e48f6b46a907a34a71a5220fccc
8383

8484
RUN set -ex \
8585
&& cd /usr/src \
@@ -95,7 +95,7 @@ RUN set -ex \
9595

9696
# geos
9797
ENV GEOS_VERSION master
98-
ENV GEOS_GIT_HASH cb127eeac823c8b48364c1b437844a5b65ff4748
98+
ENV GEOS_GIT_HASH 1bfc5b27493c552fd9a28823358a4c1f4c3b65f7
9999

100100
RUN set -ex \
101101
&& cd /usr/src \
@@ -112,7 +112,7 @@ RUN set -ex \
112112

113113
# gdal
114114
ENV GDAL_VERSION master
115-
ENV GDAL_GIT_HASH d7ae1604aabf4aa7fbf955f8913a4a892927b60d
115+
ENV GDAL_GIT_HASH 51e564e9364243be48da5e264c0507d7a9c546d8
116116

117117
RUN set -ex \
118118
&& cd /usr/src \
@@ -171,9 +171,9 @@ RUN set -ex \
171171
COPY --from=builder /usr/local /usr/local
172172

173173
ENV SFCGAL_GIT_HASH e4fcf6b2e166a862db568a0419fe100849d3f447
174-
ENV PROJ_GIT_HASH d41c10c9e1e787a521a3841605a2e6024649eb3f
175-
ENV GEOS_GIT_HASH cb127eeac823c8b48364c1b437844a5b65ff4748
176-
ENV GDAL_GIT_HASH d7ae1604aabf4aa7fbf955f8913a4a892927b60d
174+
ENV PROJ_GIT_HASH d902272785a55e48f6b46a907a34a71a5220fccc
175+
ENV GEOS_GIT_HASH 1bfc5b27493c552fd9a28823358a4c1f4c3b65f7
176+
ENV GDAL_GIT_HASH 51e564e9364243be48da5e264c0507d7a9c546d8
177177

178178
# Minimal command line test.
179179
RUN set -ex \
@@ -187,7 +187,7 @@ RUN set -ex \
187187

188188
# install postgis
189189
ENV POSTGIS_VERSION master
190-
ENV POSTGIS_GIT_HASH e2d34f1190d0a1de352de455fcb5352df8997ace
190+
ENV POSTGIS_GIT_HASH 54a0c748dbb165847c1d0fe3abbe22dd48b8237a
191191

192192
RUN set -ex \
193193
&& apt-get update \

13-master/Dockerfile

+7-7
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ RUN set -ex \
7979

8080
# proj
8181
ENV PROJ_VERSION master
82-
ENV PROJ_GIT_HASH d41c10c9e1e787a521a3841605a2e6024649eb3f
82+
ENV PROJ_GIT_HASH d902272785a55e48f6b46a907a34a71a5220fccc
8383

8484
RUN set -ex \
8585
&& cd /usr/src \
@@ -95,7 +95,7 @@ RUN set -ex \
9595

9696
# geos
9797
ENV GEOS_VERSION master
98-
ENV GEOS_GIT_HASH cb127eeac823c8b48364c1b437844a5b65ff4748
98+
ENV GEOS_GIT_HASH 1bfc5b27493c552fd9a28823358a4c1f4c3b65f7
9999

100100
RUN set -ex \
101101
&& cd /usr/src \
@@ -112,7 +112,7 @@ RUN set -ex \
112112

113113
# gdal
114114
ENV GDAL_VERSION master
115-
ENV GDAL_GIT_HASH d7ae1604aabf4aa7fbf955f8913a4a892927b60d
115+
ENV GDAL_GIT_HASH 51e564e9364243be48da5e264c0507d7a9c546d8
116116

117117
RUN set -ex \
118118
&& cd /usr/src \
@@ -171,9 +171,9 @@ RUN set -ex \
171171
COPY --from=builder /usr/local /usr/local
172172

173173
ENV SFCGAL_GIT_HASH e4fcf6b2e166a862db568a0419fe100849d3f447
174-
ENV PROJ_GIT_HASH d41c10c9e1e787a521a3841605a2e6024649eb3f
175-
ENV GEOS_GIT_HASH cb127eeac823c8b48364c1b437844a5b65ff4748
176-
ENV GDAL_GIT_HASH d7ae1604aabf4aa7fbf955f8913a4a892927b60d
174+
ENV PROJ_GIT_HASH d902272785a55e48f6b46a907a34a71a5220fccc
175+
ENV GEOS_GIT_HASH 1bfc5b27493c552fd9a28823358a4c1f4c3b65f7
176+
ENV GDAL_GIT_HASH 51e564e9364243be48da5e264c0507d7a9c546d8
177177

178178
# Minimal command line test.
179179
RUN set -ex \
@@ -187,7 +187,7 @@ RUN set -ex \
187187

188188
# install postgis
189189
ENV POSTGIS_VERSION master
190-
ENV POSTGIS_GIT_HASH e2d34f1190d0a1de352de455fcb5352df8997ace
190+
ENV POSTGIS_GIT_HASH 54a0c748dbb165847c1d0fe3abbe22dd48b8237a
191191

192192
RUN set -ex \
193193
&& apt-get update \

14beta2-3.1/Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM postgres:14beta2
2+
3+
LABEL maintainer="PostGIS Project - https://postgis.net"
4+
5+
ENV POSTGIS_MAJOR 3
6+
ENV POSTGIS_VERSION 3.1.2+dfsg-1~exp2.pgdg100+1
7+
8+
RUN apt-get update \
9+
&& apt-cache showpkg postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR \
10+
&& apt-get install -y --no-install-recommends \
11+
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION \
12+
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts=$POSTGIS_VERSION \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
RUN mkdir -p /docker-entrypoint-initdb.d
16+
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
17+
COPY ./update-postgis.sh /usr/local/bin
18+

14beta2-3.1/README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# postgis/postgis
2+
3+
[![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)
4+
5+
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 both 2.5.x and 3.1.x for each supported version of Postgres (9.5, 9.6, 10, 11, 12 and 13). Additionally, an image version is provided which is built from the latest version of Postgres (13) with versions of PostGIS and its dependencies built from their respective master branches.
6+
7+
This image ensures that the default database created by the parent `postgres` image will have the following extensions installed:
8+
9+
* `postgis`
10+
* `postgis_topology`
11+
* `postgis_tiger_geocoder`
12+
13+
Note: As of PostGIS v3.x, raster has been factored out into a separate extension `postgis_raster` which must be installed separately.
14+
15+
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`.
16+
17+
## Usage
18+
19+
In order to run a basic container capable of serving a PostGIS-enabled database, start a container as follows:
20+
21+
docker run --name some-postgis -e POSTGRES_PASSWORD=mysecretpassword -d postgis/postgis
22+
23+
For more detailed instructions about how to start and control your Postgres container, see the documentation for the `postgres` image [here](https://registry.hub.docker.com/_/postgres/).
24+
25+
Once you have started a database container, you can then connect to the database either directly on the running container:
26+
27+
docker exec -ti some-postgis psql -U postgres
28+
29+
... or starting a new container to run as a client. In this case you can use a user-defined network to link both containers:
30+
31+
docker network create some-network
32+
33+
# Server container
34+
docker run --name some-postgis --network some-network -e POSTGRES_PASSWORD=mysecretpassword -d postgis/postgis
35+
36+
# Client container
37+
docker run -it --rm --network some-network postgis/postgis psql -h some-postgis -U postgres
38+
39+
Check the documentation on the [`postgres` image](https://registry.hub.docker.com/_/postgres/) and [Docker networking](https://docs.docker.com/network/) for more details and alternatives on connecting different containers.
40+
41+
See [the PostGIS documentation](http://postgis.net/docs/postgis_installation.html#create_new_db_extensions) for more details on your options for creating and using a spatially-enabled database.
42+
43+
## Known Issues / Errors
44+
45+
When You encouter errors due to PostGIS update `OperationalError: could not access file "$libdir/postgis-X.X`, run:
46+
47+
`docker exec some-postgis update-postgis.sh`
48+
49+
It will update to Your newest PostGIS. Update is idempotent, so it won't hurt when You run it more than once, You will get notification like:
50+
51+
```
52+
Updating PostGIS extensions template_postgis to X.X.X
53+
NOTICE: version "X.X.X" of extension "postgis" is already installed
54+
NOTICE: version "X.X.X" of extension "postgis_topology" is already installed
55+
NOTICE: version "X.X.X" of extension "postgis_tiger_geocoder" is already installed
56+
ALTER EXTENSION
57+
Updating PostGIS extensions docker to X.X.X
58+
NOTICE: version "X.X.X" of extension "postgis" is already installed
59+
NOTICE: version "X.X.X" of extension "postgis_topology" is already installed
60+
NOTICE: version "X.X.X" of extension "postgis_tiger_geocoder" is already installed
61+
ALTER EXTENSION
62+
```
63+

14beta2-3.1/alpine/Dockerfile

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
FROM postgres:14beta2-alpine
2+
3+
LABEL maintainer="PostGIS Project - https://postgis.net"
4+
5+
ENV POSTGIS_VERSION 3.1.3
6+
ENV POSTGIS_SHA256 885e11b26d8385aff49e605d33749a83e711180a3b1996395564ddf6346f3bb4
7+
8+
#Temporary fix:
9+
# for PostGIS 2.* - building a special geos
10+
# reason: PostGIS 2.5.5 is not working with GEOS 3.9.*
11+
ENV POSTGIS2_GEOS_VERSION tags/3.8.2
12+
13+
RUN set -eux \
14+
\
15+
&& apk add --no-cache --virtual .fetch-deps \
16+
ca-certificates \
17+
openssl \
18+
tar \
19+
\
20+
&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \
21+
&& echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \
22+
&& mkdir -p /usr/src/postgis \
23+
&& tar \
24+
--extract \
25+
--file postgis.tar.gz \
26+
--directory /usr/src/postgis \
27+
--strip-components 1 \
28+
&& rm postgis.tar.gz \
29+
\
30+
&& apk add --no-cache --virtual .build-deps \
31+
autoconf \
32+
automake \
33+
clang-dev \
34+
file \
35+
g++ \
36+
gcc \
37+
gdal-dev \
38+
gettext-dev \
39+
json-c-dev \
40+
libtool \
41+
libxml2-dev \
42+
llvm11-dev \
43+
make \
44+
pcre-dev \
45+
perl \
46+
proj-dev \
47+
protobuf-c-dev \
48+
\
49+
# GEOS setup
50+
&& if [ $(printf %.1s "$POSTGIS_VERSION") == 3 ]; then \
51+
apk add --no-cache --virtual .build-deps-geos geos-dev cunit-dev ; \
52+
elif [ $(printf %.1s "$POSTGIS_VERSION") == 2 ]; then \
53+
apk add --no-cache --virtual .build-deps-geos cmake git ; \
54+
cd /usr/src ; \
55+
git clone https://github.com/libgeos/geos.git ; \
56+
cd geos ; \
57+
git checkout ${POSTGIS2_GEOS_VERSION} -b geos_build ; \
58+
mkdir cmake-build ; \
59+
cd cmake-build ; \
60+
cmake -DCMAKE_BUILD_TYPE=Release .. ; \
61+
make -j$(nproc) ; \
62+
make check ; \
63+
make install ; \
64+
cd / ; \
65+
rm -fr /usr/src/geos ; \
66+
else \
67+
echo ".... unknown PosGIS ...." ; \
68+
fi \
69+
\
70+
# build PostGIS
71+
\
72+
&& cd /usr/src/postgis \
73+
&& gettextize \
74+
&& ./autogen.sh \
75+
&& ./configure \
76+
--with-pcredir="$(pcre-config --prefix)" \
77+
&& make -j$(nproc) \
78+
&& make install \
79+
\
80+
# regress check
81+
&& mkdir /tempdb \
82+
&& chown -R postgres:postgres /tempdb \
83+
&& su postgres -c 'pg_ctl -D /tempdb init' \
84+
&& su postgres -c 'pg_ctl -D /tempdb start' \
85+
&& cd regress \
86+
&& make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \
87+
#&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \
88+
#&& make garden PGUSER=postgres \
89+
&& su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \
90+
&& rm -rf /tempdb \
91+
&& rm -rf /tmp/pgis_reg \
92+
# add .postgis-rundeps
93+
&& apk add --no-cache --virtual .postgis-rundeps \
94+
gdal \
95+
json-c \
96+
libstdc++ \
97+
pcre \
98+
proj \
99+
protobuf-c \
100+
# Geos setup
101+
&& if [ $(printf %.1s "$POSTGIS_VERSION") == 3 ]; then \
102+
apk add --no-cache --virtual .postgis-rundeps-geos geos ; \
103+
fi \
104+
# clean
105+
&& cd / \
106+
&& rm -rf /usr/src/postgis \
107+
&& apk del .fetch-deps .build-deps .build-deps-geos
108+
109+
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
110+
COPY ./update-postgis.sh /usr/local/bin

14beta2-3.1/alpine/initdb-postgis.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# Perform all actions as $POSTGRES_USER
6+
export PGUSER="$POSTGRES_USER"
7+
8+
# Create the 'template_postgis' template db
9+
"${psql[@]}" <<- 'EOSQL'
10+
CREATE DATABASE template_postgis IS_TEMPLATE true;
11+
EOSQL
12+
13+
# Load PostGIS into both template_database and $POSTGRES_DB
14+
for DB in template_postgis "$POSTGRES_DB"; do
15+
echo "Loading PostGIS extensions into $DB"
16+
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
17+
CREATE EXTENSION IF NOT EXISTS postgis;
18+
CREATE EXTENSION IF NOT EXISTS postgis_topology;
19+
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
20+
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
21+
EOSQL
22+
done

14beta2-3.1/alpine/update-postgis.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# Perform all actions as $POSTGRES_USER
6+
export PGUSER="$POSTGRES_USER"
7+
8+
POSTGIS_VERSION="${POSTGIS_VERSION%%+*}"
9+
10+
# Load PostGIS into both template_database and $POSTGRES_DB
11+
for DB in template_postgis "$POSTGRES_DB" "${@}"; do
12+
echo "Updating PostGIS extensions '$DB' to $POSTGIS_VERSION"
13+
psql --dbname="$DB" -c "
14+
-- Upgrade PostGIS (includes raster)
15+
CREATE EXTENSION IF NOT EXISTS postgis VERSION '$POSTGIS_VERSION';
16+
ALTER EXTENSION postgis UPDATE TO '$POSTGIS_VERSION';
17+
18+
-- Upgrade Topology
19+
CREATE EXTENSION IF NOT EXISTS postgis_topology VERSION '$POSTGIS_VERSION';
20+
ALTER EXTENSION postgis_topology UPDATE TO '$POSTGIS_VERSION';
21+
22+
-- Install Tiger dependencies in case not already installed
23+
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
24+
-- Upgrade US Tiger Geocoder
25+
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder VERSION '$POSTGIS_VERSION';
26+
ALTER EXTENSION postgis_tiger_geocoder UPDATE TO '$POSTGIS_VERSION';
27+
"
28+
done

14beta2-3.1/initdb-postgis.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
# Perform all actions as $POSTGRES_USER
6+
export PGUSER="$POSTGRES_USER"
7+
8+
# Create the 'template_postgis' template db
9+
"${psql[@]}" <<- 'EOSQL'
10+
CREATE DATABASE template_postgis IS_TEMPLATE true;
11+
EOSQL
12+
13+
# Load PostGIS into both template_database and $POSTGRES_DB
14+
for DB in template_postgis "$POSTGRES_DB"; do
15+
echo "Loading PostGIS extensions into $DB"
16+
"${psql[@]}" --dbname="$DB" <<-'EOSQL'
17+
CREATE EXTENSION IF NOT EXISTS postgis;
18+
CREATE EXTENSION IF NOT EXISTS postgis_topology;
19+
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
20+
CREATE EXTENSION IF NOT EXISTS postgis_tiger_geocoder;
21+
EOSQL
22+
done

0 commit comments

Comments
 (0)