Skip to content

Commit 02b1678

Browse files
WarpSQL/bitnami: Add PostGIS extension to PostgreSQL
1. Specify POSTGIS_MAJOR, PG_MAJOR, and POSTGIS_VERSION arguments 2. Update and install necessary dependencies 3. Add PostgreSQL repository and import key 4. Install PostGIS extension with specified versions 5. Clean up apt lists
1 parent e05ff91 commit 02b1678

1 file changed

Lines changed: 0 additions & 231 deletions

File tree

Dockerfile

Lines changed: 0 additions & 231 deletions
Original file line numberDiff line numberDiff line change
@@ -226,234 +226,3 @@ RUN set -eux \
226226
&& cd / \
227227
&& rm -rf /usr/src/postgis \
228228
&& apk del .fetch-deps .build-deps
229-
230-
ARG PG_VERSION
231-
ARG PREV_IMAGE
232-
ARG TS_VERSION
233-
############################
234-
# Build tools binaries in separate image
235-
############################
236-
ARG GO_VERSION=1.18.7
237-
FROM golang:${GO_VERSION}-alpine AS tools
238-
239-
ENV TOOLS_VERSION 0.8.1
240-
241-
RUN apk update && apk add --no-cache git gcc musl-dev \
242-
&& go install github.com/timescale/timescaledb-tune/cmd/timescaledb-tune@latest \
243-
&& go install github.com/timescale/timescaledb-parallel-copy/cmd/timescaledb-parallel-copy@latest
244-
245-
############################
246-
# Grab old versions from previous version
247-
############################
248-
ARG PG_VERSION
249-
ARG PREV_IMAGE
250-
FROM ${PREV_IMAGE} AS oldversions
251-
# Remove update files, mock files, and all but the last 5 .so/.sql files
252-
RUN rm -f $(pg_config --sharedir)/extension/timescaledb*mock*.sql \
253-
&& if [ -f $(pg_config --pkglibdir)/timescaledb-tsl-1*.so ]; then rm -f $(ls -1 $(pg_config --pkglibdir)/timescaledb-tsl-1*.so | head -n -5); fi \
254-
&& if [ -f $(pg_config --pkglibdir)/timescaledb-1*.so ]; then rm -f $(ls -1 $(pg_config --pkglibdir)/timescaledb-*.so | head -n -5); fi \
255-
&& if [ -f $(pg_config --sharedir)/extension/timescaledb--1*.sql ]; then rm -f $(ls -1 $(pg_config --sharedir)/extension/timescaledb--1*.sql | head -n -5); fi
256-
257-
############################
258-
# Now build image and copy in tools
259-
############################
260-
ARG PG_VERSION
261-
FROM postgres:${PG_VERSION}-alpine
262-
ARG OSS_ONLY
263-
264-
LABEL maintainer="Timescale https://www.timescale.com"
265-
266-
COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/
267-
COPY --from=tools /go/bin/* /usr/local/bin/
268-
COPY --from=oldversions /usr/local/lib/postgresql/timescaledb-*.so /usr/local/lib/postgresql/
269-
COPY --from=oldversions /usr/local/share/postgresql/extension/timescaledb--*.sql /usr/local/share/postgresql/extension/
270-
271-
ARG TS_VERSION
272-
RUN set -ex \
273-
&& apk add libssl1.1 \
274-
&& apk add --no-cache --virtual .fetch-deps \
275-
ca-certificates \
276-
git \
277-
openssl \
278-
openssl-dev \
279-
tar \
280-
&& mkdir -p /build/ \
281-
&& git clone https://github.com/timescale/timescaledb /build/timescaledb \
282-
\
283-
&& apk add --no-cache --virtual .build-deps \
284-
coreutils \
285-
dpkg-dev dpkg \
286-
gcc \
287-
krb5-dev \
288-
libc-dev \
289-
make \
290-
cmake \
291-
util-linux-dev \
292-
\
293-
# Build current version \
294-
&& cd /build/timescaledb && rm -fr build \
295-
&& git checkout ${TS_VERSION} \
296-
&& ./bootstrap -DCMAKE_BUILD_TYPE=RelWithDebInfo -DREGRESS_CHECKS=OFF -DTAP_CHECKS=OFF -DGENERATE_DOWNGRADE_SCRIPT=ON -DWARNINGS_AS_ERRORS=OFF -DPROJECT_INSTALL_METHOD="docker"${OSS_ONLY} \
297-
&& cd build && make install \
298-
&& cd ~ \
299-
\
300-
&& if [ "${OSS_ONLY}" != "" ]; then rm -f $(pg_config --pkglibdir)/timescaledb-tsl-*.so; fi \
301-
&& apk del .fetch-deps .build-deps \
302-
&& rm -rf /build \
303-
&& sed -r -i "s/[#]*\s*(shared_preload_libraries)\s*=\s*'(.*)'/\1 = 'timescaledb,\2'/;s/,'/'/" /usr/local/share/postgresql/postgresql.conf.sample
304-
305-
# Update to shared_preload_libraries
306-
RUN echo "shared_preload_libraries = 'citus,timescaledb,pg_stat_statements'" >> /usr/local/share/postgresql/postgresql.conf.sample
307-
308-
# Adding PG Vector
309-
310-
RUN cd /tmp
311-
RUN apk add --no-cache --virtual .build-deps \
312-
coreutils \
313-
dpkg-dev dpkg \
314-
gcc \
315-
git \
316-
krb5-dev \
317-
libc-dev \
318-
llvm15 \
319-
clang \
320-
make \
321-
cmake \
322-
util-linux-dev \
323-
&& git clone --branch v0.4.1 https://github.com/pgvector/pgvector.git \
324-
&& cd /pgvector \
325-
&& ls \
326-
&& make \
327-
&& make install
328-
329-
## Adding Citus
330-
331-
# Install Citus dependencies
332-
RUN apk add --no-cache --virtual .citus-deps \
333-
curl \
334-
jq
335-
336-
# Install Citus
337-
ARG CITUS_VERSION
338-
RUN set -ex \
339-
&& apk add --no-cache --virtual .citus-build-deps \
340-
gcc \
341-
libc-dev \
342-
make \
343-
curl-dev \
344-
lz4-dev \
345-
zstd-dev \
346-
clang \
347-
krb5-dev \
348-
icu-dev \
349-
libxslt-dev \
350-
libxml2-dev \
351-
llvm15-dev \
352-
&& CITUS_DOWNLOAD_URL="https://github.com/citusdata/citus/archive/refs/tags/v${CITUS_VERSION}.tar.gz" \
353-
&& curl -L -o /tmp/citus.tar.gz "${CITUS_DOWNLOAD_URL}" \
354-
&& tar -C /tmp -xvf /tmp/citus.tar.gz \
355-
&& chown -R postgres:postgres /tmp/citus-${CITUS_VERSION} \
356-
&& cd /tmp/citus-${CITUS_VERSION} \
357-
&& PATH="/usr/local/pgsql/bin:$PATH" ./configure \
358-
&& make \
359-
&& make install \
360-
&& cd ~ \
361-
&& rm -rf /tmp/citus.tar.gz /tmp/citus-${CITUS_VERSION} \
362-
&& apk del .citus-deps .citus-build-deps
363-
364-
365-
ARG POSTGIS_VERSION
366-
ARG POSTGIS_SHA256
367-
368-
RUN set -eux \
369-
\
370-
&& if [ $(printf %.1s "$POSTGIS_VERSION") == 3 ]; then \
371-
set -eux ; \
372-
export GEOS_ALPINE_VER=3.11 ; \
373-
export GDAL_ALPINE_VER=3.5 ; \
374-
export PROJ_ALPINE_VER=9.1 ; \
375-
elif [ $(printf %.1s "$POSTGIS_VERSION") == 2 ]; then \
376-
set -eux ; \
377-
export GEOS_ALPINE_VER=3.8 ; \
378-
export GDAL_ALPINE_VER=3.2 ; \
379-
export PROJ_ALPINE_VER=7.2 ; \
380-
\
381-
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/main' >> /etc/apk/repositories ; \
382-
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.14/community' >> /etc/apk/repositories ; \
383-
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/main' >> /etc/apk/repositories ; \
384-
echo 'https://dl-cdn.alpinelinux.org/alpine/v3.13/community' >> /etc/apk/repositories ; \
385-
\
386-
else \
387-
set -eux ; \
388-
echo ".... unknown \$POSTGIS_VERSION ...." ; \
389-
exit 1 ; \
390-
fi \
391-
\
392-
&& apk add --no-cache --virtual .fetch-deps \
393-
ca-certificates \
394-
openssl \
395-
tar \
396-
\
397-
&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \
398-
&& echo "${POSTGIS_SHA256} *postgis.tar.gz" | sha256sum -c - \
399-
&& mkdir -p /usr/src/postgis \
400-
&& tar \
401-
--extract \
402-
--file postgis.tar.gz \
403-
--directory /usr/src/postgis \
404-
--strip-components 1 \
405-
&& rm postgis.tar.gz \
406-
\
407-
&& apk add --no-cache --virtual .build-deps \
408-
\
409-
gdal-dev~=${GDAL_ALPINE_VER} \
410-
geos-dev~=${GEOS_ALPINE_VER} \
411-
proj-dev~=${PROJ_ALPINE_VER} \
412-
\
413-
autoconf \
414-
automake \
415-
clang-dev \
416-
cunit-dev \
417-
file \
418-
g++ \
419-
gcc \
420-
gettext-dev \
421-
git \
422-
json-c-dev \
423-
libtool \
424-
libxml2-dev \
425-
llvm-dev \
426-
make \
427-
pcre-dev \
428-
perl \
429-
protobuf-c-dev \
430-
\
431-
# build PostGIS
432-
\
433-
&& cd /usr/src/postgis \
434-
&& gettextize \
435-
&& ./autogen.sh \
436-
&& ./configure \
437-
--with-pcredir="$(pcre-config --prefix)" \
438-
&& make -j$(nproc) \
439-
&& make install \
440-
\
441-
# add .postgis-rundeps
442-
&& apk add --no-cache --virtual .postgis-rundeps \
443-
\
444-
gdal~=${GDAL_ALPINE_VER} \
445-
geos~=${GEOS_ALPINE_VER} \
446-
proj~=${PROJ_ALPINE_VER} \
447-
\
448-
json-c \
449-
libstdc++ \
450-
pcre \
451-
protobuf-c \
452-
\
453-
# ca-certificates: for accessing remote raster files
454-
# fix https://github.com/postgis/docker-postgis/issues/307
455-
ca-certificates \
456-
# clean
457-
&& cd / \
458-
&& rm -rf /usr/src/postgis \
459-
&& apk del .fetch-deps .build-deps

0 commit comments

Comments
 (0)