Skip to content

Commit 2939402

Browse files
authored
add 13-master and update 12-master (#195) (#196)
1 parent 71afa6f commit 2939402

File tree

6 files changed

+281
-3
lines changed

6 files changed

+281
-3
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ services: docker
55
dist: xenial
66

77
env:
8+
- VERSION=13-master
89
- VERSION=12-master
910
- VERSION=12-3.0
1011
- VERSION=12-3.0 VARIANT=alpine
@@ -30,6 +31,7 @@ env:
3031
jobs:
3132
allow_failures:
3233
- env: VERSION=12-master
34+
- env: VERSION=13-master
3335

3436
script:
3537
- if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then

12-master/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ LABEL maintainer="PostGIS Project - https://postgis.net"
55
ENV SFCGAL_VERSION master
66
ENV SFCGAL_GIT_HASH 929605c8ea85f2c01efa116e1ed0eb01d285ea09
77
ENV PROJ_VERSION master
8-
ENV PROJ_GIT_HASH 0c9cf39297a24d5e56aa488820a5ba3edaace90e
8+
ENV PROJ_GIT_HASH 5d502d356e16ef81f481eb82dcdeba0ea3ab1f9e
99
ENV GDAL_VERSION master
10-
ENV GDAL_GIT_HASH ab634ff99f45ef87f2d3e862a56b2289bba653d5
10+
ENV GDAL_GIT_HASH 5adc1949498b536cc787920c99db965c20c03b69
1111
ENV GEOS_VERSION master
1212
ENV GEOS_GIT_HASH 099e74b3127348e1f8544ab279b609e2fdc6cc74
1313
ENV POSTGIS_VERSION master
14-
ENV POSTGIS_GIT_HASH 4c185f8617824a21f46569170dd16c3427e1b197
14+
ENV POSTGIS_GIT_HASH 16121bf7939891022824152c0ca095aeebbad2ed
1515

1616
RUN set -ex \
1717
&& apt-get update \

13-master/Dockerfile

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
FROM postgres:13
2+
3+
LABEL maintainer="PostGIS Project - https://postgis.net"
4+
5+
ENV SFCGAL_VERSION master
6+
ENV SFCGAL_GIT_HASH 929605c8ea85f2c01efa116e1ed0eb01d285ea09
7+
ENV PROJ_VERSION master
8+
ENV PROJ_GIT_HASH 5d502d356e16ef81f481eb82dcdeba0ea3ab1f9e
9+
ENV GDAL_VERSION master
10+
ENV GDAL_GIT_HASH 5adc1949498b536cc787920c99db965c20c03b69
11+
ENV GEOS_VERSION master
12+
ENV GEOS_GIT_HASH 099e74b3127348e1f8544ab279b609e2fdc6cc74
13+
ENV POSTGIS_VERSION master
14+
ENV POSTGIS_GIT_HASH 16121bf7939891022824152c0ca095aeebbad2ed
15+
16+
RUN set -ex \
17+
&& apt-get update \
18+
&& apt-get install -y --no-install-recommends \
19+
curl \
20+
libboost-atomic1.67.0 \
21+
libboost-chrono1.67.0 \
22+
libboost-date-time1.67.0 \
23+
libboost-filesystem1.67.0 \
24+
libboost-program-options1.67.0 \
25+
libboost-serialization1.67.0 \
26+
libboost-system1.67.0 \
27+
libboost-test1.67.0 \
28+
libboost-thread1.67.0 \
29+
libboost-timer1.67.0 \
30+
libcgal13 \
31+
libcurl3-gnutls \
32+
libexpat1 \
33+
libgmp10 \
34+
libgmpxx4ldbl \
35+
libjson-c3 \
36+
libmpfr6 \
37+
libprotobuf-c1 \
38+
libtiff5 \
39+
libxml2 \
40+
sqlite3 \
41+
&& apt-get install -y --no-install-recommends \
42+
autoconf \
43+
automake \
44+
autotools-dev \
45+
bison \
46+
build-essential \
47+
ca-certificates \
48+
cmake \
49+
git \
50+
g++ \
51+
libboost-all-dev \
52+
libcgal-dev \
53+
libcurl4-gnutls-dev \
54+
libgmp-dev \
55+
libjson-c-dev \
56+
libmpfr-dev \
57+
libprotobuf-c-dev \
58+
libsqlite3-dev \
59+
libtiff-dev \
60+
libtool \
61+
libxml2-dev \
62+
make \
63+
pkg-config \
64+
postgresql-server-dev-$PG_MAJOR \
65+
protobuf-c-compiler \
66+
xsltproc \
67+
# sfcgal
68+
&& mkdir -p /usr/src/sfcgal \
69+
&& cd /usr/src/sfcgal \
70+
&& git init \
71+
&& git remote add origin https://github.com/Oslandia/SFCGAL.git \
72+
&& git fetch --depth 1 origin :${SFCGAL_GIT_HASH} \
73+
&& git reset --hard FETCH_HEAD \
74+
&& mkdir cmake-build \
75+
&& cd cmake-build \
76+
&& cmake .. \
77+
&& make -j$(nproc) \
78+
&& make install \
79+
&& cd / \
80+
&& rm -fr /usr/src/sfcgal \
81+
# proj4
82+
&& mkdir -p /usr/src/proj \
83+
&& cd /usr/src/proj \
84+
&& git init \
85+
&& git remote add origin https://github.com/OSGeo/PROJ.git \
86+
&& git fetch --depth 1 origin :${PROJ_GIT_HASH} \
87+
&& git reset --hard FETCH_HEAD \
88+
&& ./autogen.sh \
89+
&& ./configure --disable-static \
90+
&& make -j$(nproc) \
91+
&& make install \
92+
&& cd / \
93+
&& rm -fr /usr/src/proj \
94+
# geos
95+
&& mkdir -p /usr/src/geos \
96+
&& cd /usr/src/geos \
97+
&& git init \
98+
&& git remote add origin https://github.com/libgeos/geos.git \
99+
&& git fetch --depth 1 origin :${GEOS_GIT_HASH} \
100+
&& git reset --hard FETCH_HEAD \
101+
&& ./autogen.sh \
102+
&& ./configure --disable-static \
103+
&& make -j$(nproc) \
104+
&& make install \
105+
&& cd / \
106+
&& rm -fr /usr/src/geos \
107+
# gdal
108+
&& mkdir -p /usr/src/gdal \
109+
&& cd /usr/src/gdal \
110+
&& git init \
111+
&& git remote add origin https://github.com/OSGeo/gdal.git \
112+
&& git fetch --depth 1 origin :${GDAL_GIT_HASH} \
113+
&& git reset --hard FETCH_HEAD \
114+
&& cd gdal \
115+
&& ./autogen.sh \
116+
&& ./configure --disable-static \
117+
&& make -j$(nproc) \
118+
&& make install \
119+
&& cd / \
120+
&& rm -fr /usr/src/gdal \
121+
# postgis
122+
&& mkdir -p /usr/src/postgis \
123+
&& cd /usr/src/postgis \
124+
&& git init \
125+
&& git remote add origin https://git.osgeo.org/gitea/postgis/postgis.git \
126+
&& git fetch --depth 1 origin :${POSTGIS_GIT_HASH} \
127+
&& git reset --hard FETCH_HEAD \
128+
&& ./autogen.sh \
129+
# configure options taken from:
130+
# https://anonscm.debian.org/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie
131+
&& ./configure \
132+
# --with-gui \
133+
&& make -j$(nproc) \
134+
&& make install \
135+
&& cd / \
136+
&& rm -rf /usr/src/postgis \
137+
&& apt-get purge -y --autoremove \
138+
autoconf \
139+
automake \
140+
autotools-dev \
141+
bison \
142+
build-essential \
143+
ca-certificates \
144+
cmake \
145+
git \
146+
g++ \
147+
libboost-all-dev \
148+
libcgal-dev \
149+
libcurl4-gnutls-dev \
150+
libgmp-dev \
151+
libjson-c-dev \
152+
libmpfr-dev \
153+
libprotobuf-c-dev \
154+
libsqlite3-dev \
155+
libtiff-dev \
156+
libtool \
157+
libxml2-dev \
158+
make \
159+
pkg-config \
160+
postgresql-server-dev-$PG_MAJOR \
161+
protobuf-c-compiler \
162+
xsltproc \
163+
&& rm -rf /var/lib/apt/lists/* \
164+
# Minimal command line test.
165+
&& cs2cs \
166+
&& gdalinfo --version \
167+
&& geos-config --version \
168+
&& ogr2ogr --version \
169+
&& proj \
170+
&& sfcgal-config --version
171+
172+
RUN mkdir -p /docker-entrypoint-initdb.d
173+
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
174+
COPY ./update-postgis.sh /usr/local/bin
175+

13-master/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# postgis/postgis
2+
3+
[![Build Status](https://travis-ci.org/postgis/docker-postgis.svg)](https://travis-ci.org/postgis/docker-postgis) [![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.0.x for each supported version of Postgres (9.5, 9.6, 10, 11, and 12). Additionally, an image version is provided which is built from the latest version of Postgres (12) 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+
* `fuzzystrmatch`
12+
* `postgis_tiger_geocoder`
13+
14+
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`.
15+
16+
## Usage
17+
18+
In order to run a basic container capable of serving a PostGIS-enabled database, start a container as follows:
19+
20+
docker run --name some-postgis -e POSTGRES_PASSWORD=mysecretpassword -d postgis/postgis
21+
22+
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/).
23+
24+
Once you have started a database container, you can then connect to the database as follows:
25+
26+
docker run -it --link some-postgis:postgres --rm postgres \
27+
sh -c 'exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres'
28+
29+
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.
30+
31+
## Known Issues / Errors
32+
33+
When You encouter errors due to PostGIS update `OperationalError: could not access file "$libdir/postgis-X.X`, run:
34+
35+
`docker exec some-postgis update-postgis.sh`
36+
37+
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:
38+
39+
```
40+
Updating PostGIS extensions template_postgis to X.X.X
41+
NOTICE: version "X.X.X" of extension "postgis" is already installed
42+
NOTICE: version "X.X.X" of extension "postgis_topology" is already installed
43+
NOTICE: version "X.X.X" of extension "postgis_tiger_geocoder" is already installed
44+
ALTER EXTENSION
45+
Updating PostGIS extensions docker to X.X.X
46+
NOTICE: version "X.X.X" of extension "postgis" is already installed
47+
NOTICE: version "X.X.X" of extension "postgis_topology" is already installed
48+
NOTICE: version "X.X.X" of extension "postgis_tiger_geocoder" is already installed
49+
ALTER EXTENSION
50+
```
51+

13-master/initdb-postgis.sh

Lines changed: 22 additions & 0 deletions
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

13-master/update-postgis.sh

Lines changed: 28 additions & 0 deletions
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

0 commit comments

Comments
 (0)