1- FROM postgres:10-alpine3.14
1+ FROM postgres:10-alpine3.15
22
33LABEL maintainer="PostGIS Project - https://postgis.net"
44
55ENV POSTGIS_VERSION 2.5.5
66ENV POSTGIS_SHA256 24b15ee36f3af02015da0e92a18f9046ea0b4fd24896196c8e6c2aa8e4b56baa
77
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-
138RUN set -eux \
149 \
10+ && if [ $(printf %.1s "$POSTGIS_VERSION" ) == 3 ]; then \
11+ set -eux ; \
12+ #
13+ # using only v3.15
14+ #
15+ # GEOS: https://pkgs.alpinelinux.org/packages?name=geos&branch=v3.15 \
16+ export GEOS_ALPINE_VER=3.10 ; \
17+ # GDAL: https://pkgs.alpinelinux.org/packages?name=gdal&branch=v3.15 \
18+ export GDAL_ALPINE_VER=3.4 ; \
19+ # PROJ: https://pkgs.alpinelinux.org/packages?name=proj&branch=v3.15 \
20+ export PROJ_ALPINE_VER=8.2 ; \
21+ #
22+ elif [ $(printf %.1s "$POSTGIS_VERSION" ) == 2 ]; then \
23+ set -eux ; \
24+ #
25+ # using older branches v3.13; v3.14 for GEOS,GDAL,PROJ
26+ #
27+ # GEOS: https://pkgs.alpinelinux.org/packages?name=geos&branch=v3.13 \
28+ export GEOS_ALPINE_VER=3.8 ; \
29+ # GDAL: https://pkgs.alpinelinux.org/packages?name=gdal&branch=v3.14 \
30+ export GDAL_ALPINE_VER=3.2 ; \
31+ # PROJ: https://pkgs.alpinelinux.org/packages?name=proj&branch=v3.14 \
32+ export PROJ_ALPINE_VER=7.2 ; \
33+ #
34+ \
35+ echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/main' >> /etc/apk/repositories ; \
36+ echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/community' >> /etc/apk/repositories ; \
37+ echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories ; \
38+ echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/community' >> /etc/apk/repositories ; \
39+ \
40+ else \
41+ set -eux ; \
42+ echo ".... unknown \$ POSTGIS_VERSION ...." ; \
43+ exit 1 ; \
44+ fi \
45+ \
1546 && apk add --no-cache --virtual .fetch-deps \
1647 ca-certificates \
1748 openssl \
1849 tar \
1950 \
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 - \
51+ && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${ POSTGIS_VERSION} .tar.gz" \
52+ && echo "${ POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \
2253 && mkdir -p /usr/src/postgis \
2354 && tar \
2455 --extract \
@@ -28,44 +59,26 @@ RUN set -eux \
2859 && rm postgis.tar.gz \
2960 \
3061 && apk add --no-cache --virtual .build-deps \
62+ \
63+ gdal-dev~=${GDAL_ALPINE_VER} \
64+ geos-dev~=${GEOS_ALPINE_VER} \
65+ proj-dev~=${PROJ_ALPINE_VER} \
66+ \
3167 autoconf \
3268 automake \
3369 clang-dev \
3470 file \
3571 g++ \
3672 gcc \
37- gdal-dev \
3873 gettext-dev \
3974 json-c-dev \
4075 libtool \
4176 libxml2-dev \
42- llvm11 -dev \
77+ llvm -dev \
4378 make \
4479 pcre-dev \
4580 perl \
46- proj-dev \
4781 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 \
6982 \
7083# build PostGIS
7184 \
@@ -86,25 +99,31 @@ RUN set -eux \
8699 && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \
87100 # && make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \
88101 # && make garden PGUSER=postgres \
102+ \
103+ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
104+ && su postgres -c 'psql -t -c "SELECT version();"' >> /_pgis_full_version.txt \
105+ && su postgres -c 'psql -t -c "SELECT PostGIS_Full_Version();"' >> /_pgis_full_version.txt \
106+ \
89107 && su postgres -c 'pg_ctl -D /tempdb --mode=immediate stop' \
90108 && rm -rf /tempdb \
91109 && rm -rf /tmp/pgis_reg \
92110# add .postgis-rundeps
93111 && apk add --no-cache --virtual .postgis-rundeps \
94- gdal \
112+ \
113+ gdal~=${GDAL_ALPINE_VER} \
114+ geos~=${GEOS_ALPINE_VER} \
115+ proj~=${PROJ_ALPINE_VER} \
116+ \
95117 json-c \
96118 libstdc++ \
97119 pcre \
98- proj \
99120 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 \
104121# clean
105122 && cd / \
106123 && rm -rf /usr/src/postgis \
107- && apk del .fetch-deps .build-deps .build-deps-geos
124+ && apk del .fetch-deps .build-deps \
125+ # print PostGIS_Full_Version() for the log. ( experimental & internal )
126+ && cat /_pgis_full_version.txt
108127
109128COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
110129COPY ./update-postgis.sh /usr/local/bin
0 commit comments