From 288326caa5779854c41c7b170fa0df51c6404650 Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 22 May 2024 18:09:05 +0200 Subject: [PATCH] Add debian based database image --- .github/workflows/database.yml | 5 +++ infra/docker/database/pg16_debian.Dockerfile | 34 ++++---------------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml index f481cbda7f..d3cea3be54 100644 --- a/.github/workflows/database.yml +++ b/.github/workflows/database.yml @@ -33,6 +33,11 @@ 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 diff --git a/infra/docker/database/pg16_debian.Dockerfile b/infra/docker/database/pg16_debian.Dockerfile index 8c0fa954d2..9e1d8fbb65 100644 --- a/infra/docker/database/pg16_debian.Dockerfile +++ b/infra/docker/database/pg16_debian.Dockerfile @@ -1,31 +1,12 @@ -ARG TO_PG_MAJOR +ARG PG_MAJOR ARG TIMESCALEDB_VERSION ARG POSTGIS_VERSION -ARG DISTRIBUTION -FROM postgres:$TO_PG_MAJOR-$DISTRIBUTION -ARG TO_PG_MAJOR +FROM postgres:$PG_MAJOR-bookworm +ARG PG_MAJOR ARG TIMESCALEDB_VERSION ARG POSTGIS_VERSION -ENV PGBINNEW /usr/lib/postgresql/$TO_PG_MAJOR/bin - -ENV PGDATANEW /var/lib/postgresql/$TO_PG_MAJOR/data - -RUN set -eux; \ - mkdir -p "$PGDATANEW"; \ - chown -R postgres:postgres /var/lib/postgresql - -WORKDIR /var/lib/postgresql - -COPY infra/docker/database/docker-upgrade /usr/local/bin/ - -ENTRYPOINT ["docker-upgrade"] - -# recommended: --link -CMD ["pg_upgrade"] - - # Install TimescaleDB extension in both versions of Postgres RUN apt-get update RUN apt-get install -y wget lsb-release @@ -36,16 +17,13 @@ RUN apt-get update RUN \ TIMESCALEDB_MAJOR=$(echo $TIMESCALEDB_VERSION | cut -c1) && \ - apt-get install -y timescaledb-$TIMESCALEDB_MAJOR-postgresql-$FROM_PG_MAJOR=$TIMESCALEDB_VERSION* timescaledb-$TIMESCALEDB_MAJOR-loader-postgresql-$FROM_PG_MAJOR=$TIMESCALEDB_VERSION* && \ - apt-get install -y timescaledb-$TIMESCALEDB_MAJOR-postgresql-$TO_PG_MAJOR=$TIMESCALEDB_VERSION* timescaledb-$TIMESCALEDB_MAJOR-loader-postgresql-$TO_PG_MAJOR=$TIMESCALEDB_VERSION* + apt-get install -y timescaledb-$TIMESCALEDB_MAJOR-postgresql-$PG_MAJOR=$TIMESCALEDB_VERSION* timescaledb-$TIMESCALEDB_MAJOR-loader-postgresql-$PG_MAJOR=$TIMESCALEDB_VERSION* # Install PostGIS extension in both versions of Postgres RUN apt update RUN \ POSTGIS_MAJOR=$(echo $POSTGIS_VERSION | cut -c1) && \ apt install -y --no-install-recommends \ - postgresql-$FROM_PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION* \ - postgresql-$FROM_PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ - postgresql-$TO_PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION* \ - postgresql-$TO_PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR=$POSTGIS_VERSION* \ + postgresql-$PG_MAJOR-postgis-$POSTGIS_MAJOR-scripts \ && rm -rf /var/lib/apt/lists/* \ No newline at end of file