@@ -73,7 +73,7 @@ RUN set -ex \
7373 && rm -rf /build \
7474 && sed -r -i "s/[#]*\s *(shared_preload_libraries)\s *=\s *'(.*)'/\1 = 'timescaledb,\2 '/;s/,'/'/" /usr/local/share/postgresql/postgresql.conf.sample
7575
76- # Add Citus to shared_preload_libraries
76+ # Update to shared_preload_libraries
7777RUN echo "shared_preload_libraries = 'citus,timescaledb,pg_stat_statements'" >> /usr/local/share/postgresql/postgresql.conf.sample
7878
7979# Adding PG Vector
@@ -131,3 +131,98 @@ RUN set -ex \
131131 && cd ~ \
132132 && rm -rf /tmp/citus.tar.gz /tmp/citus-${CITUS_VERSION} \
133133 && apk del .citus-deps .citus-build-deps
134+
135+
136+ ARG POSTGIS_VERSION
137+ ARG POSTGIS_SHA256
138+
139+ RUN set -eux \
140+ \
141+ && if [ $(printf %.1s "$POSTGIS_VERSION" ) == 3 ]; then \
142+ set -eux ; \
143+ export GEOS_ALPINE_VER=3.11 ; \
144+ export GDAL_ALPINE_VER=3.5 ; \
145+ export PROJ_ALPINE_VER=9.1 ; \
146+ elif [ $(printf %.1s "$POSTGIS_VERSION" ) == 2 ]; then \
147+ set -eux ; \
148+ export GEOS_ALPINE_VER=3.8 ; \
149+ export GDAL_ALPINE_VER=3.2 ; \
150+ export PROJ_ALPINE_VER=7.2 ; \
151+ \
152+ echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/main' >> /etc/apk/repositories ; \
153+ echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/community' >> /etc/apk/repositories ; \
154+ echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories ; \
155+ echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/community' >> /etc/apk/repositories ; \
156+ \
157+ else \
158+ set -eux ; \
159+ echo ".... unknown \$ POSTGIS_VERSION ...." ; \
160+ exit 1 ; \
161+ fi \
162+ \
163+ && apk add --no-cache --virtual .fetch-deps \
164+ ca-certificates \
165+ openssl \
166+ tar \
167+ \
168+ && wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \
169+ && echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \
170+ && mkdir -p /usr/src/postgis \
171+ && tar \
172+ --extract \
173+ --file postgis.tar.gz \
174+ --directory /usr/src/postgis \
175+ --strip-components 1 \
176+ && rm postgis.tar.gz \
177+ \
178+ && apk add --no-cache --virtual .build-deps \
179+ \
180+ gdal-dev~=${GDAL_ALPINE_VER} \
181+ geos-dev~=${GEOS_ALPINE_VER} \
182+ proj-dev~=${PROJ_ALPINE_VER} \
183+ \
184+ autoconf \
185+ automake \
186+ clang-dev \
187+ cunit-dev \
188+ file \
189+ g++ \
190+ gcc \
191+ gettext-dev \
192+ git \
193+ json-c-dev \
194+ libtool \
195+ libxml2-dev \
196+ llvm-dev \
197+ make \
198+ pcre-dev \
199+ perl \
200+ protobuf-c-dev \
201+ \
202+ # build PostGIS
203+ \
204+ && cd /usr/src/postgis \
205+ && gettextize \
206+ && ./autogen.sh \
207+ && ./configure \
208+ --with-pcredir="$(pcre-config --prefix)" \
209+ && make -j$(nproc) \
210+ && make install \
211+ \
212+ # add .postgis-rundeps
213+ && apk add --no-cache --virtual .postgis-rundeps \
214+ \
215+ gdal~=${GDAL_ALPINE_VER} \
216+ geos~=${GEOS_ALPINE_VER} \
217+ proj~=${PROJ_ALPINE_VER} \
218+ \
219+ json-c \
220+ libstdc++ \
221+ pcre \
222+ protobuf-c \
223+ \
224+ ca-certificates \
225+ # clean
226+ && cd / \
227+ && rm -rf /usr/src/postgis \
228+ && apk del .fetch-deps .build-deps
0 commit comments