Skip to content

Commit 67969eb

Browse files
authored
alpine upgrade to 3.15 (#281)
* - upgrade to alpine 3.15 ( from alpine 3.14 ) - postgis 2.5 : revert geos build and using older package from alpine repo = v3.13 - postgis 2.5 : using older gdal, proj from alpine repo = v3.14 - small refactoring - added `_pgis_full_version.txt` debug file for alpine build. ( experimental ) * formatting
1 parent 08c9e75 commit 67969eb

File tree

10 files changed

+580
-390
lines changed

10 files changed

+580
-390
lines changed

10-2.5/alpine/Dockerfile

Lines changed: 58 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,55 @@
1-
FROM postgres:10-alpine3.14
1+
FROM postgres:10-alpine3.15
22

33
LABEL maintainer="PostGIS Project - https://postgis.net"
44

55
ENV POSTGIS_VERSION 2.5.5
66
ENV 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-
138
RUN 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

109128
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
110129
COPY ./update-postgis.sh /usr/local/bin

10-3.2/alpine/Dockerfile

Lines changed: 58 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,55 @@
1-
FROM postgres:10-alpine3.14
1+
FROM postgres:10-alpine3.15
22

33
LABEL maintainer="PostGIS Project - https://postgis.net"
44

55
ENV POSTGIS_VERSION 3.2.0
66
ENV POSTGIS_SHA256 c725d1be6d57ad199bbb6393cc3546defb70de1c78fe1787f7ccef2d51c3647b
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-
138
RUN 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

109128
COPY ./initdb-postgis.sh /docker-entrypoint-initdb.d/10_postgis.sh
110129
COPY ./update-postgis.sh /usr/local/bin

0 commit comments

Comments
 (0)