Skip to content

Commit

Permalink
Use debian based image for postgres 13 and 16
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentAntoine committed May 23, 2024
1 parent 288326c commit 118e777
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 108 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ jobs:
postgis_version: "3.4.2"
dockerfile: "pg13_16.Dockerfile"
image_version: "pg16-ts2.14.2-postgis3.4.2"
- pg_major: "16"
timescaledb_version: "2.14.2"
postgis_version: "3.4.2"
dockerfile: "pg16_debian.Dockerfile"
image_version: "bookworm-pg16-ts2.14.2-postgis3.4.2"
permissions:
contents: read
packages: write
Expand Down
104 changes: 30 additions & 74 deletions infra/docker/database/pg13_16.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,35 @@ ARG PG_MAJOR
ARG TIMESCALEDB_VERSION
ARG POSTGIS_VERSION

FROM timescale/timescaledb:${TIMESCALEDB_VERSION}-pg${PG_MAJOR}
FROM postgres:$PG_MAJOR-bookworm
ARG PG_MAJOR
ARG TIMESCALEDB_VERSION
ARG POSTGIS_VERSION

RUN set -eux \
&& apk add --no-cache --virtual .fetch-deps \
ca-certificates \
openssl \
tar \
\
&& wget -O postgis.tar.gz "https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz" \
&& mkdir -p /usr/src/postgis \
&& tar \
--extract \
--file postgis.tar.gz \
--directory /usr/src/postgis \
--strip-components 1 \
&& rm postgis.tar.gz \
\
&& apk add --no-cache --virtual .build-deps \
\
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 \
cunit-dev \
file \
g++ \
gcc \
gettext-dev \
git \
json-c-dev \
libtool \
libxml2-dev \
make \
pcre2-dev \
perl \
protobuf-c-dev \
\
# build PostGIS - with Link Time Optimization (LTO) enabled
&& cd /usr/src/postgis \
&& gettextize \
&& ./autogen.sh \
&& ./configure \
--enable-lto \
&& make -j$(nproc) \
&& make install \
\
# add .postgis-rundeps
&& apk add --no-cache --virtual .postgis-rundeps \
\
gdal \
geos \
proj \
sfcgal \
\
json-c \
libstdc++ \
pcre2 \
protobuf-c \
\
# ca-certificates: for accessing remote raster files
# fix https://github.com/postgis/docker-postgis/issues/307
ca-certificates \
# clean
&& cd / \
&& rm -rf /usr/src/postgis \
&& apk del .fetch-deps .build-deps \
RUN \
apt-get update && \
apt-get install -y \
wget \
lsb-release

# Install TimescaleDB extension in both versions of Postgres
RUN echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main"
RUN echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/timescaledb.list
RUN wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add -

RUN \
TIMESCALEDB_MAJOR=$(echo $TIMESCALEDB_VERSION | cut -c1) && \
apt-get update && \
apt-get install -y \
timescaledb-$TIMESCALEDB_MAJOR-postgresql-$PG_MAJOR=$TIMESCALEDB_VERSION* \
timescaledb-$TIMESCALEDB_MAJOR-loader-postgresql-$PG_MAJOR=$TIMESCALEDB_VERSION* && \
rm -rf /var/lib/apt/lists/*

# Install PostGIS extension in both versions of Postgres
RUN \
POSTGIS_MAJOR=$(echo $POSTGIS_VERSION | cut -c1) && \
apt update && \
apt install -y --no-install-recommends \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION* \
postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts && \
rm -rf /var/lib/apt/lists/*
29 changes: 0 additions & 29 deletions infra/docker/database/pg16_debian.Dockerfile

This file was deleted.

0 comments on commit 118e777

Please sign in to comment.