Skip to content

update/refactor alpine3.18 postgis template #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 30 additions & 57 deletions 11-3.3/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY.
#
ARG BASE_IMAGE=postgres:11-alpine3.17
ARG BASE_IMAGE=postgres:11-alpine3.18
FROM ${BASE_IMAGE}

LABEL maintainer="PostGIS Project - https://postgis.net" \
Expand All @@ -12,43 +12,6 @@ ENV POSTGIS_VERSION 3.3.2
ENV POSTGIS_SHA256 2a6858d1df06de1c5f85a5b780773e92f6ba3a5dc09ac31120ac895242f5a77b

RUN set -eux \
\
&& if [ $(printf %.1s "$POSTGIS_VERSION") == 3 ]; then \
set -eux ; \
#
# using only v3.17
#
#GEOS: https://pkgs.alpinelinux.org/packages?name=geos&branch=v3.17 \
export GEOS_ALPINE_VER=3.11 ; \
#GDAL: https://pkgs.alpinelinux.org/packages?name=gdal&branch=v3.17 \
export GDAL_ALPINE_VER=3.5 ; \
#PROJ: https://pkgs.alpinelinux.org/packages?name=proj&branch=v3.17 \
export PROJ_ALPINE_VER=9.1 ; \
#
elif [ $(printf %.1s "$POSTGIS_VERSION") == 2 ]; then \
set -eux ; \
#
# using older branches v3.13; v3.14 for GEOS,GDAL,PROJ
#
#GEOS: https://pkgs.alpinelinux.org/packages?name=geos&branch=v3.13 \
export GEOS_ALPINE_VER=3.8 ; \
#GDAL: https://pkgs.alpinelinux.org/packages?name=gdal&branch=v3.14 \
export GDAL_ALPINE_VER=3.2 ; \
#PROJ: https://pkgs.alpinelinux.org/packages?name=proj&branch=v3.14 \
export PROJ_ALPINE_VER=7.2 ; \
#
\
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/main' >> /etc/apk/repositories ; \
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/community' >> /etc/apk/repositories ; \
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories ; \
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/community' >> /etc/apk/repositories ; \
\
else \
set -eux ; \
echo ".... unknown \$POSTGIS_VERSION ...." ; \
exit 1 ; \
fi \
\
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
openssl \
Expand All @@ -66,13 +29,19 @@ RUN set -eux \
\
&& apk add --no-cache --virtual .build-deps \
\
gdal-dev~=${GDAL_ALPINE_VER} \
geos-dev~=${GEOS_ALPINE_VER} \
proj-dev~=${PROJ_ALPINE_VER} \
gdal-dev \
geos-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 \
clang-dev \
cunit-dev \
file \
g++ \
Expand All @@ -82,36 +51,38 @@ RUN set -eux \
json-c-dev \
libtool \
libxml2-dev \
llvm-dev \
make \
pcre-dev \
pcre2-dev \
perl \
protobuf-c-dev \
\
# build PostGIS
\
# build PostGIS - with Link Time Optimization (LTO) enabled
&& cd /usr/src/postgis \
&& gettextize \
&& ./autogen.sh \
&& ./configure \
--with-pcredir="$(pcre-config --prefix)" \
--enable-lto \
&& make -j$(nproc) \
&& make install \
\
# regress check
# 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 start' \
&& cd regress \
&& make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \
#&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \
#&& make garden 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;"' \
## sfcgal expected with the next alpine release : 3.18
#&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \
&& 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 address_standardizer;"' \
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \
Expand All @@ -127,13 +98,14 @@ RUN set -eux \
# add .postgis-rundeps
&& apk add --no-cache --virtual .postgis-rundeps \
\
gdal~=${GDAL_ALPINE_VER} \
geos~=${GEOS_ALPINE_VER} \
proj~=${PROJ_ALPINE_VER} \
gdal \
geos \
proj \
sfcgal \
\
json-c \
libstdc++ \
pcre \
pcre2 \
protobuf-c \
\
# ca-certificates: for accessing remote raster files
Expand All @@ -143,7 +115,8 @@ RUN set -eux \
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps \
# print PostGIS_Full_Version() for the log. ( experimental & internal )
# 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
Expand Down
87 changes: 30 additions & 57 deletions 12-3.3/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "make update"! PLEASE DO NOT EDIT IT DIRECTLY.
#
ARG BASE_IMAGE=postgres:12-alpine3.17
ARG BASE_IMAGE=postgres:12-alpine3.18
FROM ${BASE_IMAGE}

LABEL maintainer="PostGIS Project - https://postgis.net" \
Expand All @@ -12,43 +12,6 @@ ENV POSTGIS_VERSION 3.3.2
ENV POSTGIS_SHA256 2a6858d1df06de1c5f85a5b780773e92f6ba3a5dc09ac31120ac895242f5a77b

RUN set -eux \
\
&& if [ $(printf %.1s "$POSTGIS_VERSION") == 3 ]; then \
set -eux ; \
#
# using only v3.17
#
#GEOS: https://pkgs.alpinelinux.org/packages?name=geos&branch=v3.17 \
export GEOS_ALPINE_VER=3.11 ; \
#GDAL: https://pkgs.alpinelinux.org/packages?name=gdal&branch=v3.17 \
export GDAL_ALPINE_VER=3.5 ; \
#PROJ: https://pkgs.alpinelinux.org/packages?name=proj&branch=v3.17 \
export PROJ_ALPINE_VER=9.1 ; \
#
elif [ $(printf %.1s "$POSTGIS_VERSION") == 2 ]; then \
set -eux ; \
#
# using older branches v3.13; v3.14 for GEOS,GDAL,PROJ
#
#GEOS: https://pkgs.alpinelinux.org/packages?name=geos&branch=v3.13 \
export GEOS_ALPINE_VER=3.8 ; \
#GDAL: https://pkgs.alpinelinux.org/packages?name=gdal&branch=v3.14 \
export GDAL_ALPINE_VER=3.2 ; \
#PROJ: https://pkgs.alpinelinux.org/packages?name=proj&branch=v3.14 \
export PROJ_ALPINE_VER=7.2 ; \
#
\
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/main' >> /etc/apk/repositories ; \
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/community' >> /etc/apk/repositories ; \
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories ; \
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/community' >> /etc/apk/repositories ; \
\
else \
set -eux ; \
echo ".... unknown \$POSTGIS_VERSION ...." ; \
exit 1 ; \
fi \
\
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
openssl \
Expand All @@ -66,13 +29,19 @@ RUN set -eux \
\
&& apk add --no-cache --virtual .build-deps \
\
gdal-dev~=${GDAL_ALPINE_VER} \
geos-dev~=${GEOS_ALPINE_VER} \
proj-dev~=${PROJ_ALPINE_VER} \
gdal-dev \
geos-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 \
clang-dev \
cunit-dev \
file \
g++ \
Expand All @@ -82,36 +51,38 @@ RUN set -eux \
json-c-dev \
libtool \
libxml2-dev \
llvm-dev \
make \
pcre-dev \
pcre2-dev \
perl \
protobuf-c-dev \
\
# build PostGIS
\
# build PostGIS - with Link Time Optimization (LTO) enabled
&& cd /usr/src/postgis \
&& gettextize \
&& ./autogen.sh \
&& ./configure \
--with-pcredir="$(pcre-config --prefix)" \
--enable-lto \
&& make -j$(nproc) \
&& make install \
\
# regress check
# 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 start' \
&& cd regress \
&& make -j$(nproc) check RUNTESTFLAGS=--extension PGUSER=postgres \
#&& make -j$(nproc) check RUNTESTFLAGS=--dumprestore PGUSER=postgres \
#&& make garden 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;"' \
## sfcgal expected with the next alpine release : 3.18
#&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS postgis_sfcgal;"' \
&& 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 address_standardizer;"' \
&& su postgres -c 'psql -c "CREATE EXTENSION IF NOT EXISTS address_standardizer_data_us;"' \
Expand All @@ -127,13 +98,14 @@ RUN set -eux \
# add .postgis-rundeps
&& apk add --no-cache --virtual .postgis-rundeps \
\
gdal~=${GDAL_ALPINE_VER} \
geos~=${GEOS_ALPINE_VER} \
proj~=${PROJ_ALPINE_VER} \
gdal \
geos \
proj \
sfcgal \
\
json-c \
libstdc++ \
pcre \
pcre2 \
protobuf-c \
\
# ca-certificates: for accessing remote raster files
Expand All @@ -143,7 +115,8 @@ RUN set -eux \
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps \
# print PostGIS_Full_Version() for the log. ( experimental & internal )
# 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
Expand Down
Loading