11#
22# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY.
33#
4- ARG BASE_IMAGE=postgres:11-alpine3.17
4+ ARG BASE_IMAGE=postgres:11-alpine3.18
55FROM ${BASE_IMAGE}
66
77LABEL maintainer="PostGIS Project - https://postgis.net" \
@@ -12,43 +12,6 @@ ENV POSTGIS_VERSION 3.3.2
1212ENV POSTGIS_SHA256 2a6858d1df06de1c5f85a5b780773e92f6ba3a5dc09ac31120ac895242f5a77b
1313
1414RUN set -eux \
15- \
16- && if [ $(printf %.1s "$POSTGIS_VERSION" ) == 3 ]; then \
17- set -eux ; \
18- #
19- # using only v3.17
20- #
21- # GEOS: https://pkgs.alpinelinux.org/packages?name=geos&branch=v3.17 \
22- export GEOS_ALPINE_VER=3.11 ; \
23- # GDAL: https://pkgs.alpinelinux.org/packages?name=gdal&branch=v3.17 \
24- export GDAL_ALPINE_VER=3.5 ; \
25- # PROJ: https://pkgs.alpinelinux.org/packages?name=proj&branch=v3.17 \
26- export PROJ_ALPINE_VER=9.1 ; \
27- #
28- elif [ $(printf %.1s "$POSTGIS_VERSION" ) == 2 ]; then \
29- set -eux ; \
30- #
31- # using older branches v3.13; v3.14 for GEOS,GDAL,PROJ
32- #
33- # GEOS: https://pkgs.alpinelinux.org/packages?name=geos&branch=v3.13 \
34- export GEOS_ALPINE_VER=3.8 ; \
35- # GDAL: https://pkgs.alpinelinux.org/packages?name=gdal&branch=v3.14 \
36- export GDAL_ALPINE_VER=3.2 ; \
37- # PROJ: https://pkgs.alpinelinux.org/packages?name=proj&branch=v3.14 \
38- export PROJ_ALPINE_VER=7.2 ; \
39- #
40- \
41- echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/main' >> /etc/apk/repositories ; \
42- echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/community' >> /etc/apk/repositories ; \
43- echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories ; \
44- echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/community' >> /etc/apk/repositories ; \
45- \
46- else \
47- set -eux ; \
48- echo ".... unknown \$ POSTGIS_VERSION ...." ; \
49- exit 1 ; \
50- fi \
51- \
5215 && apk add --no-cache --virtual .fetch-deps \
5316 ca-certificates \
5417 openssl \
@@ -66,13 +29,19 @@ RUN set -eux \
6629 \
6730 && apk add --no-cache --virtual .build-deps \
6831 \
69- gdal-dev~=${GDAL_ALPINE_VER} \
70- geos-dev~=${GEOS_ALPINE_VER} \
71- proj-dev~=${PROJ_ALPINE_VER} \
32+ gdal-dev \
33+ geos-dev \
34+ proj-dev \
35+ proj-util \
36+ sfcgal-dev \
37+ \
38+ # The upstream variable, '$DOCKER_PG_LLVM_DEPS' contains
39+ # the correct versions of 'llvm-dev' and 'clang' for the current version of PostgreSQL.
40+ # This improvement has been discussed in https://github.com/docker-library/postgres/pull/1077
41+ $DOCKER_PG_LLVM_DEPS \
7242 \
7343 autoconf \
7444 automake \
75- clang-dev \
7645 cunit-dev \
7746 file \
7847 g++ \
@@ -82,36 +51,38 @@ RUN set -eux \
8251 json-c-dev \
8352 libtool \
8453 libxml2-dev \
85- llvm-dev \
8654 make \
87- pcre -dev \
55+ pcre2 -dev \
8856 perl \
8957 protobuf-c-dev \
9058 \
91- # build PostGIS
92- \
59+ # build PostGIS - with Link Time Optimization (LTO) enabled
9360 && cd /usr/src/postgis \
9461 && gettextize \
9562 && ./autogen.sh \
9663 && ./configure \
97- --with-pcredir= "$(pcre-config --prefix)" \
64+ --enable-lto \
9865 && make -j$(nproc) \
9966 && make install \
10067 \
101- # regress check
68+ # This section is for refreshing the proj data for the regression tests.
69+ # It serves as a workaround for an issue documented at https://trac.osgeo.org/postgis/ticket/5316
70+ # This increases the Docker image size by about 1 MB.
71+ && projsync --system-directory --file ch_swisstopo_CHENyx06_ETRS \
72+ && projsync --system-directory --file us_noaa_eshpgn \
73+ && projsync --system-directory --file us_noaa_prvi \
74+ && projsync --system-directory --file us_noaa_wmhpgn \
75+ # This section performs a regression check.
10276 && mkdir /tempdb \
10377 && chown -R postgres:postgres /tempdb \
10478 && su postgres -c 'pg_ctl -D /tempdb init' \
10579 && su postgres -c 'pg_ctl -D /tempdb start' \
10680 && cd regress \
10781 && make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \
108- # && make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \
109- # && make garden PGUSER=postgres \
11082 \
11183 && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis;"' \
11284 && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_raster;"' \
113- # # sfcgal expected with the next alpine release : 3.18
114- # && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \
85+ && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \
11586 && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS fuzzystrmatch; --needed for postgis_tiger_geocoder "' \
11687 && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer;"' \
11788 && su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \
@@ -127,13 +98,14 @@ RUN set -eux \
12798# add .postgis-rundeps
12899 && apk add --no-cache --virtual .postgis-rundeps \
129100 \
130- gdal~=${GDAL_ALPINE_VER} \
131- geos~=${GEOS_ALPINE_VER} \
132- proj~=${PROJ_ALPINE_VER} \
101+ gdal \
102+ geos \
103+ proj \
104+ sfcgal \
133105 \
134106 json-c \
135107 libstdc++ \
136- pcre \
108+ pcre2 \
137109 protobuf-c \
138110 \
139111 # ca-certificates: for accessing remote raster files
@@ -143,7 +115,8 @@ RUN set -eux \
143115 && cd / \
144116 && rm -rf /usr/src/postgis \
145117 && apk del .fetch-deps .build-deps \
146- # print PostGIS_Full_Version() for the log. ( experimental & internal )
118+ # At the end of the build, we print the collected information
119+ # from the '/_pgis_full_version.txt' file. This is for experimental and internal purposes.
147120 && cat /_pgis_full_version.txt
148121
149122COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
0 commit comments