From a006835eba50150e15b2c62f7cb50f981e1e8102 Mon Sep 17 00:00:00 2001 From: souravbiswassanto Date: Thu, 7 May 2026 11:02:49 +0600 Subject: [PATCH 1/4] test Signed-off-by: souravbiswassanto --- dhi/18.3/debian/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 dhi/18.3/debian/Dockerfile diff --git a/dhi/18.3/debian/Dockerfile b/dhi/18.3/debian/Dockerfile new file mode 100644 index 0000000000..8c463e0b70 --- /dev/null +++ b/dhi/18.3/debian/Dockerfile @@ -0,0 +1,5 @@ +FROM dhi.io/postgres:18-debian13-dev AS builder + +FROM dhi.io/postgres:18-debian13 +COPY --from=builder /usr/bin/find /usr/bin/find +COPY --from=builder /usr/bin/grep /usr/bin/grep From 4f1971edf74769aebecdbb69857c5f6251e92dd0 Mon Sep 17 00:00:00 2001 From: souravbiswassanto Date: Tue, 12 May 2026 16:23:28 +0600 Subject: [PATCH 2/4] Add Postgres Dockerfile with extension for postgres 16.13, 17.9, 18.3 Signed-off-by: souravbiswassanto --- ext/16.13/alpine/Dockerfile | 175 ++++++++++++++++++++++++++++++++++ ext/16.13/bookworm/Dockerfile | 168 ++++++++++++++++++++++++++++++++ ext/17.9/alpine/Dockerfile | 175 ++++++++++++++++++++++++++++++++++ ext/17.9/bookworm/Dockerfile | 168 ++++++++++++++++++++++++++++++++ ext/18.3/alpine/Dockerfile | 175 ++++++++++++++++++++++++++++++++++ ext/18.3/bookworm/Dockerfile | 169 ++++++++++++++++++++++++++++++++ 6 files changed, 1030 insertions(+) create mode 100644 ext/16.13/alpine/Dockerfile create mode 100644 ext/16.13/bookworm/Dockerfile create mode 100644 ext/17.9/alpine/Dockerfile create mode 100644 ext/17.9/bookworm/Dockerfile create mode 100644 ext/18.3/alpine/Dockerfile create mode 100644 ext/18.3/bookworm/Dockerfile diff --git a/ext/16.13/alpine/Dockerfile b/ext/16.13/alpine/Dockerfile new file mode 100644 index 0000000000..d0eb7123a5 --- /dev/null +++ b/ext/16.13/alpine/Dockerfile @@ -0,0 +1,175 @@ +# ============================================================================= +# PostgreSQL 16 Alpine — Custom Image +# Extensions: pgvector 0.8.2, PostGIS 3.6.2, pg_repack 1.5.3, +# pg_cron 1.6.7, pgaudit 16.x +# ============================================================================= + +# ----------------------------------------------------------------------------- +# Stage 1: Builder +# ----------------------------------------------------------------------------- +FROM ghcr.io/appscode-images/postgres:16.13-alpine AS builder + +# Extension versions pinned to PostgreSQL 16 compatible releases +ENV PGVECTOR_VERSION=0.8.2 +ENV POSTGIS_VERSION=3.6.2 +ENV PG_REPACK_VERSION=1.5.3 +ENV PG_CRON_VERSION=1.6.7 +# pgaudit uses the REL_16_STABLE branch (tracks the latest 16.x patch) +ENV PGAUDIT_VERSION=REL_16_STABLE + +# Ensure pg_config is on PATH +ENV PATH="/usr/local/pgsql/bin:/usr/local/bin:/usr/bin:/bin:${PATH}" + +# --------------------------------------------------------------------------- +# Install build-time dependencies +# $DOCKER_PG_LLVM_DEPS is set by the base postgres Alpine image and resolves +# to the correct llvm/clang version for this PostgreSQL build. +# --------------------------------------------------------------------------- +RUN apk add --no-cache --virtual .build-deps \ + autoconf \ + automake \ + ca-certificates \ + clang \ + cmake \ + cunit-dev \ + curl \ + file \ + g++ \ + gawk \ + gcc \ + gdal-dev \ + geos-dev \ + gettext-dev \ + git \ + json-c-dev \ + krb5-dev \ + libtool \ + libxml2-dev \ + llvm \ + lz4-dev \ + make \ + openssl \ + pcre2-dev \ + perl \ + proj-dev \ + proj-util \ + protobuf-c-dev \ + sfcgal-dev \ + tar \ + unzip \ + util-linux-dev \ + zlib-dev \ + $DOCKER_PG_LLVM_DEPS + +# --------------------------------------------------------------------------- +# 1. Build pgvector +# --------------------------------------------------------------------------- +RUN git clone --branch v${PGVECTOR_VERSION} --depth 1 \ + https://github.com/pgvector/pgvector.git /tmp/pgvector + +RUN cd /tmp/pgvector \ + && make clean + +RUN cd /tmp/pgvector \ + && make + +RUN cd /tmp/pgvector \ + && make install + +# --------------------------------------------------------------------------- +# 2. Build PostGIS +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz \ + -o /tmp/postgis.tar.gz + +RUN mkdir -p /tmp/postgis \ + && tar --extract --file /tmp/postgis.tar.gz \ + --directory /tmp/postgis --strip-components 1 \ + && rm /tmp/postgis.tar.gz + +RUN cd /tmp/postgis \ + && gettextize + +RUN cd /tmp/postgis \ + && ./autogen.sh + +RUN cd /tmp/postgis \ + && ./configure --enable-lto + +RUN cd /tmp/postgis \ + && make -j$(nproc) + +RUN cd /tmp/postgis \ + && make install + +# --------------------------------------------------------------------------- +# 3. Build pg_repack +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + -o /tmp/pg_repack.zip + +RUN unzip /tmp/pg_repack.zip -d /tmp \ + && rm /tmp/pg_repack.zip + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make install + +# --------------------------------------------------------------------------- +# 4. Build pg_cron +# --------------------------------------------------------------------------- +RUN git clone --branch v${PG_CRON_VERSION} --depth 1 \ + https://github.com/citusdata/pg_cron.git /tmp/pg_cron + +RUN cd /tmp/pg_cron \ + && make + +RUN cd /tmp/pg_cron \ + && make install + +# --------------------------------------------------------------------------- +# 5. Build pgaudit +# --------------------------------------------------------------------------- +RUN git clone --branch ${PGAUDIT_VERSION} --depth 1 \ + https://github.com/pgaudit/pgaudit.git /tmp/pgaudit + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 install + +# --------------------------------------------------------------------------- +# Clean up build deps from builder layer (keep image lean for COPY) +# --------------------------------------------------------------------------- +RUN apk del .build-deps + + +# ============================================================================= +# Stage 2: Final image +# ============================================================================= +FROM ghcr.io/appscode-images/postgres:16.13-alpine + +# Runtime libraries required by the extensions +RUN apk add --no-cache \ + gdal \ + geos \ + json-c \ + libpq \ + libstdc++ \ + libxml2 \ + pcre2 \ + proj \ + protobuf-c \ + sfcgal + +# Copy compiled extension files from builder +COPY --from=builder /usr/local/lib/postgresql/ /usr/local/lib/postgresql/ +COPY --from=builder /usr/local/share/postgresql/ /usr/local/share/postgresql/ + +# pg_repack ships a client binary as well +COPY --from=builder /usr/local/bin/pg_repack /usr/local/bin/pg_repack \ No newline at end of file diff --git a/ext/16.13/bookworm/Dockerfile b/ext/16.13/bookworm/Dockerfile new file mode 100644 index 0000000000..5387245633 --- /dev/null +++ b/ext/16.13/bookworm/Dockerfile @@ -0,0 +1,168 @@ +# ============================================================================= +# PostgreSQL 16 Bookworm — Custom Image +# Extensions: pgvector 0.8.2, PostGIS 3.6.2, pg_repack 1.5.3, +# pg_cron 1.6.7, pgaudit 16.x +# ============================================================================= + +# ----------------------------------------------------------------------------- +# Stage 1: Builder +# ----------------------------------------------------------------------------- +FROM ghcr.io/appscode-images/postgres:16.13-bookworm AS builder + +# Extension versions pinned to PostgreSQL 16 compatible releases +ENV PGVECTOR_VERSION=0.8.2 +ENV POSTGIS_VERSION=3.6.2 +ENV PG_REPACK_VERSION=1.5.3 +ENV PG_CRON_VERSION=1.6.7 +# pgaudit uses the REL_16_STABLE branch (tracks the latest 16.x patch) +ENV PGAUDIT_VERSION=REL_16_STABLE + +# Ensure pg_config is on PATH +ENV PATH="/usr/lib/postgresql/16/bin:/usr/local/bin:/usr/bin:/bin:${PATH}" + +# --------------------------------------------------------------------------- +# Install build-time dependencies +# --------------------------------------------------------------------------- +RUN apt-get update + +RUN apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + ca-certificates \ + clang \ + cmake \ + curl \ + g++ \ + gawk \ + gcc \ + gettext \ + git \ + libc-dev \ + libcunit1-dev \ + libgdal-dev \ + libgeos-dev \ + libkrb5-dev \ + liblz4-dev \ + libjson-c-dev \ + libpcre2-dev \ + libpq-dev \ + libproj-dev \ + libprotobuf-c-dev \ + libreadline-dev \ + libsfcgal-dev \ + libxml2-dev \ + libtool \ + llvm-dev \ + make \ + pkg-config \ + postgresql-server-dev-16 \ + protobuf-c-compiler \ + unzip \ + zlib1g-dev + +RUN rm -rf /var/lib/apt/lists/* + +# --------------------------------------------------------------------------- +# 1. Build pgvector +# --------------------------------------------------------------------------- +RUN git clone --branch v${PGVECTOR_VERSION} --depth 1 \ + https://github.com/pgvector/pgvector.git /tmp/pgvector + +RUN cd /tmp/pgvector \ + && make clean + +RUN cd /tmp/pgvector \ + && make + +RUN cd /tmp/pgvector \ + && make install + +# --------------------------------------------------------------------------- +# 2. Build PostGIS +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz \ + -o /tmp/postgis.tar.gz + +RUN mkdir -p /tmp/postgis \ + && tar --extract --file /tmp/postgis.tar.gz \ + --directory /tmp/postgis --strip-components 1 \ + && rm /tmp/postgis.tar.gz + +RUN cd /tmp/postgis \ + && ./autogen.sh + +RUN cd /tmp/postgis \ + && ./configure --enable-lto + +RUN cd /tmp/postgis \ + && make -j$(nproc) + +RUN cd /tmp/postgis \ + && make install + +# --------------------------------------------------------------------------- +# 3. Build pg_repack +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + -o /tmp/pg_repack.zip + +RUN unzip /tmp/pg_repack.zip -d /tmp \ + && rm /tmp/pg_repack.zip + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make install + +# --------------------------------------------------------------------------- +# 4. Build pg_cron +# --------------------------------------------------------------------------- +RUN git clone --branch v${PG_CRON_VERSION} --depth 1 \ + https://github.com/citusdata/pg_cron.git /tmp/pg_cron + +RUN cd /tmp/pg_cron \ + && make + +RUN cd /tmp/pg_cron \ + && make install + +# --------------------------------------------------------------------------- +# 5. Build pgaudit +# --------------------------------------------------------------------------- +RUN git clone --branch ${PGAUDIT_VERSION} --depth 1 \ + https://github.com/pgaudit/pgaudit.git /tmp/pgaudit + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 install + + +# ============================================================================= +# Stage 2: Final image +# ============================================================================= +FROM ghcr.io/appscode-images/postgres:16.13-bookworm + +# Runtime libraries required by the extensions +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libgdal32 \ + libgeos-c1v5 \ + libjson-c5 \ + libpcre2-8-0 \ + libproj25 \ + libprotobuf-c1 \ + libsfcgal1 \ + libxml2 \ + && rm -rf /var/lib/apt/lists/* + +# Copy compiled extension files from builder +COPY --from=builder /usr/lib/postgresql/16/lib/ /usr/lib/postgresql/16/lib/ +COPY --from=builder /usr/share/postgresql/16/extension/ /usr/share/postgresql/16/extension/ + +# pg_repack ships a client binary as well +COPY --from=builder /usr/lib/postgresql/16/bin/pg_repack /usr/lib/postgresql/16/bin/pg_repack \ No newline at end of file diff --git a/ext/17.9/alpine/Dockerfile b/ext/17.9/alpine/Dockerfile new file mode 100644 index 0000000000..25585a9227 --- /dev/null +++ b/ext/17.9/alpine/Dockerfile @@ -0,0 +1,175 @@ +# ============================================================================= +# PostgreSQL 17 Alpine — Custom Image +# Extensions: pgvector 0.8.2, PostGIS 3.6.2, pg_repack 1.5.3, +# pg_cron 1.6.7, pgaudit 17.x +# ============================================================================= + +# ----------------------------------------------------------------------------- +# Stage 1: Builder +# ----------------------------------------------------------------------------- +FROM ghcr.io/appscode-images/postgres:17.9-alpine AS builder + +# Extension versions pinned to PostgreSQL 17 compatible releases +ENV PGVECTOR_VERSION=0.8.2 +ENV POSTGIS_VERSION=3.6.2 +ENV PG_REPACK_VERSION=1.5.3 +ENV PG_CRON_VERSION=1.6.7 +# pgaudit uses the REL_17_STABLE branch (tracks the latest 17.x patch) +ENV PGAUDIT_VERSION=REL_17_STABLE + +# Ensure pg_config is on PATH +ENV PATH="/usr/local/pgsql/bin:/usr/local/bin:/usr/bin:/bin:${PATH}" + +# --------------------------------------------------------------------------- +# Install build-time dependencies +# $DOCKER_PG_LLVM_DEPS is set by the base postgres Alpine image and resolves +# to the correct llvm/clang version for this PostgreSQL build. +# --------------------------------------------------------------------------- +RUN apk add --no-cache --virtual .build-deps \ + autoconf \ + automake \ + ca-certificates \ + clang \ + cmake \ + cunit-dev \ + curl \ + file \ + g++ \ + gawk \ + gcc \ + gdal-dev \ + geos-dev \ + gettext-dev \ + git \ + json-c-dev \ + krb5-dev \ + libtool \ + libxml2-dev \ + llvm \ + lz4-dev \ + make \ + openssl \ + pcre2-dev \ + perl \ + proj-dev \ + proj-util \ + protobuf-c-dev \ + sfcgal-dev \ + tar \ + unzip \ + util-linux-dev \ + zlib-dev \ + $DOCKER_PG_LLVM_DEPS + +# --------------------------------------------------------------------------- +# 1. Build pgvector +# --------------------------------------------------------------------------- +RUN git clone --branch v${PGVECTOR_VERSION} --depth 1 \ + https://github.com/pgvector/pgvector.git /tmp/pgvector + +RUN cd /tmp/pgvector \ + && make clean + +RUN cd /tmp/pgvector \ + && make + +RUN cd /tmp/pgvector \ + && make install + +# --------------------------------------------------------------------------- +# 2. Build PostGIS +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz \ + -o /tmp/postgis.tar.gz + +RUN mkdir -p /tmp/postgis \ + && tar --extract --file /tmp/postgis.tar.gz \ + --directory /tmp/postgis --strip-components 1 \ + && rm /tmp/postgis.tar.gz + +RUN cd /tmp/postgis \ + && gettextize + +RUN cd /tmp/postgis \ + && ./autogen.sh + +RUN cd /tmp/postgis \ + && ./configure --enable-lto + +RUN cd /tmp/postgis \ + && make -j$(nproc) + +RUN cd /tmp/postgis \ + && make install + +# --------------------------------------------------------------------------- +# 3. Build pg_repack +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + -o /tmp/pg_repack.zip + +RUN unzip /tmp/pg_repack.zip -d /tmp \ + && rm /tmp/pg_repack.zip + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make install + +# --------------------------------------------------------------------------- +# 4. Build pg_cron +# --------------------------------------------------------------------------- +RUN git clone --branch v${PG_CRON_VERSION} --depth 1 \ + https://github.com/citusdata/pg_cron.git /tmp/pg_cron + +RUN cd /tmp/pg_cron \ + && make + +RUN cd /tmp/pg_cron \ + && make install + +# --------------------------------------------------------------------------- +# 5. Build pgaudit +# --------------------------------------------------------------------------- +RUN git clone --branch ${PGAUDIT_VERSION} --depth 1 \ + https://github.com/pgaudit/pgaudit.git /tmp/pgaudit + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 install + +# --------------------------------------------------------------------------- +# Clean up build deps from builder layer (keep image lean for COPY) +# --------------------------------------------------------------------------- +RUN apk del .build-deps + + +# ============================================================================= +# Stage 2: Final image +# ============================================================================= +FROM ghcr.io/appscode-images/postgres:17.9-alpine + +# Runtime libraries required by the extensions +RUN apk add --no-cache \ + gdal \ + geos \ + json-c \ + libpq \ + libstdc++ \ + libxml2 \ + pcre2 \ + proj \ + protobuf-c \ + sfcgal + +# Copy compiled extension files from builder +COPY --from=builder /usr/local/lib/postgresql/ /usr/local/lib/postgresql/ +COPY --from=builder /usr/local/share/postgresql/ /usr/local/share/postgresql/ + +# pg_repack ships a client binary as well +COPY --from=builder /usr/local/bin/pg_repack /usr/local/bin/pg_repack \ No newline at end of file diff --git a/ext/17.9/bookworm/Dockerfile b/ext/17.9/bookworm/Dockerfile new file mode 100644 index 0000000000..2e0ec33264 --- /dev/null +++ b/ext/17.9/bookworm/Dockerfile @@ -0,0 +1,168 @@ +# ============================================================================= +# PostgreSQL 17 Bookworm — Custom Image +# Extensions: pgvector 0.8.2, PostGIS 3.6.2, pg_repack 1.5.3, +# pg_cron 1.6.7, pgaudit 17.x +# ============================================================================= + +# ----------------------------------------------------------------------------- +# Stage 1: Builder +# ----------------------------------------------------------------------------- +FROM ghcr.io/appscode-images/postgres:17.9-bookworm AS builder + +# Extension versions pinned to PostgreSQL 17 compatible releases +ENV PGVECTOR_VERSION=0.8.2 +ENV POSTGIS_VERSION=3.6.2 +ENV PG_REPACK_VERSION=1.5.3 +ENV PG_CRON_VERSION=1.6.7 +# pgaudit uses the REL_17_STABLE branch (tracks the latest 17.x patch) +ENV PGAUDIT_VERSION=REL_17_STABLE + +# Ensure pg_config is on PATH +ENV PATH="/usr/lib/postgresql/17/bin:/usr/local/bin:/usr/bin:/bin:${PATH}" + +# --------------------------------------------------------------------------- +# Install build-time dependencies +# --------------------------------------------------------------------------- +RUN apt-get update + +RUN apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + ca-certificates \ + clang \ + cmake \ + curl \ + g++ \ + gawk \ + gcc \ + gettext \ + git \ + libc-dev \ + libcunit1-dev \ + libgdal-dev \ + libgeos-dev \ + libkrb5-dev \ + liblz4-dev \ + libjson-c-dev \ + libpcre2-dev \ + libpq-dev \ + libproj-dev \ + libprotobuf-c-dev \ + libreadline-dev \ + libsfcgal-dev \ + libxml2-dev \ + libtool \ + llvm-dev \ + make \ + pkg-config \ + postgresql-server-dev-17 \ + protobuf-c-compiler \ + unzip \ + zlib1g-dev + +RUN rm -rf /var/lib/apt/lists/* + +# --------------------------------------------------------------------------- +# 1. Build pgvector +# --------------------------------------------------------------------------- +RUN git clone --branch v${PGVECTOR_VERSION} --depth 1 \ + https://github.com/pgvector/pgvector.git /tmp/pgvector + +RUN cd /tmp/pgvector \ + && make clean + +RUN cd /tmp/pgvector \ + && make + +RUN cd /tmp/pgvector \ + && make install + +# --------------------------------------------------------------------------- +# 2. Build PostGIS +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz \ + -o /tmp/postgis.tar.gz + +RUN mkdir -p /tmp/postgis \ + && tar --extract --file /tmp/postgis.tar.gz \ + --directory /tmp/postgis --strip-components 1 \ + && rm /tmp/postgis.tar.gz + +RUN cd /tmp/postgis \ + && ./autogen.sh + +RUN cd /tmp/postgis \ + && ./configure --enable-lto + +RUN cd /tmp/postgis \ + && make -j$(nproc) + +RUN cd /tmp/postgis \ + && make install + +# --------------------------------------------------------------------------- +# 3. Build pg_repack +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + -o /tmp/pg_repack.zip + +RUN unzip /tmp/pg_repack.zip -d /tmp \ + && rm /tmp/pg_repack.zip + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make install + +# --------------------------------------------------------------------------- +# 4. Build pg_cron +# --------------------------------------------------------------------------- +RUN git clone --branch v${PG_CRON_VERSION} --depth 1 \ + https://github.com/citusdata/pg_cron.git /tmp/pg_cron + +RUN cd /tmp/pg_cron \ + && make + +RUN cd /tmp/pg_cron \ + && make install + +# --------------------------------------------------------------------------- +# 5. Build pgaudit +# --------------------------------------------------------------------------- +RUN git clone --branch ${PGAUDIT_VERSION} --depth 1 \ + https://github.com/pgaudit/pgaudit.git /tmp/pgaudit + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 install + + +# ============================================================================= +# Stage 2: Final image +# ============================================================================= +FROM ghcr.io/appscode-images/postgres:17.9-bookworm + +# Runtime libraries required by the extensions +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libgdal32 \ + libgeos-c1v5 \ + libjson-c5 \ + libpcre2-8-0 \ + libproj25 \ + libprotobuf-c1 \ + libsfcgal1 \ + libxml2 \ + && rm -rf /var/lib/apt/lists/* + +# Copy compiled extension files from builder +COPY --from=builder /usr/lib/postgresql/17/lib/ /usr/lib/postgresql/17/lib/ +COPY --from=builder /usr/share/postgresql/17/extension/ /usr/share/postgresql/17/extension/ + +# pg_repack ships a client binary as well +COPY --from=builder /usr/lib/postgresql/17/bin/pg_repack /usr/lib/postgresql/17/bin/pg_repack \ No newline at end of file diff --git a/ext/18.3/alpine/Dockerfile b/ext/18.3/alpine/Dockerfile new file mode 100644 index 0000000000..646a6c6d7e --- /dev/null +++ b/ext/18.3/alpine/Dockerfile @@ -0,0 +1,175 @@ +# ============================================================================= +# PostgreSQL 18 Alpine — Custom Image +# Extensions: pgvector 0.8.2, PostGIS 3.6.2, pg_repack 1.5.3, +# pg_cron 1.6.7, pgaudit 18.x +# ============================================================================= + +# ----------------------------------------------------------------------------- +# Stage 1: Builder +# ----------------------------------------------------------------------------- +FROM ghcr.io/appscode-images/postgres:18.3-alpine AS builder + +# Extension versions pinned to PostgreSQL 18 compatible releases +ENV PGVECTOR_VERSION=0.8.2 +ENV POSTGIS_VERSION=3.6.2 +ENV PG_REPACK_VERSION=1.5.3 +ENV PG_CRON_VERSION=1.6.7 +# pgaudit uses the REL_18_STABLE branch (tracks the latest 18.x patch) +ENV PGAUDIT_VERSION=REL_18_STABLE + +# Ensure pg_config is on PATH +ENV PATH="/usr/local/pgsql/bin:/usr/local/bin:/usr/bin:/bin:${PATH}" + +# --------------------------------------------------------------------------- +# Install build-time dependencies +# $DOCKER_PG_LLVM_DEPS is set by the base postgres Alpine image and resolves +# to the correct llvm/clang version for this PostgreSQL build. +# --------------------------------------------------------------------------- +RUN apk add --no-cache --virtual .build-deps \ + autoconf \ + automake \ + ca-certificates \ + clang \ + cmake \ + cunit-dev \ + curl \ + file \ + g++ \ + gawk \ + gcc \ + gdal-dev \ + geos-dev \ + gettext-dev \ + git \ + json-c-dev \ + krb5-dev \ + libtool \ + libxml2-dev \ + llvm \ + lz4-dev \ + make \ + openssl \ + pcre2-dev \ + perl \ + proj-dev \ + proj-util \ + protobuf-c-dev \ + sfcgal-dev \ + tar \ + unzip \ + util-linux-dev \ + zlib-dev \ + $DOCKER_PG_LLVM_DEPS + +# --------------------------------------------------------------------------- +# 1. Build pgvector +# --------------------------------------------------------------------------- +RUN git clone --branch v${PGVECTOR_VERSION} --depth 1 \ + https://github.com/pgvector/pgvector.git /tmp/pgvector + +RUN cd /tmp/pgvector \ + && make clean + +RUN cd /tmp/pgvector \ + && make + +RUN cd /tmp/pgvector \ + && make install + +# --------------------------------------------------------------------------- +# 2. Build PostGIS +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz \ + -o /tmp/postgis.tar.gz + +RUN mkdir -p /tmp/postgis \ + && tar --extract --file /tmp/postgis.tar.gz \ + --directory /tmp/postgis --strip-components 1 \ + && rm /tmp/postgis.tar.gz + +RUN cd /tmp/postgis \ + && gettextize + +RUN cd /tmp/postgis \ + && ./autogen.sh + +RUN cd /tmp/postgis \ + && ./configure --enable-lto + +RUN cd /tmp/postgis \ + && make -j$(nproc) + +RUN cd /tmp/postgis \ + && make install + +# --------------------------------------------------------------------------- +# 3. Build pg_repack +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + -o /tmp/pg_repack.zip + +RUN unzip /tmp/pg_repack.zip -d /tmp \ + && rm /tmp/pg_repack.zip + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make install + +# --------------------------------------------------------------------------- +# 4. Build pg_cron +# --------------------------------------------------------------------------- +RUN git clone --branch v${PG_CRON_VERSION} --depth 1 \ + https://github.com/citusdata/pg_cron.git /tmp/pg_cron + +RUN cd /tmp/pg_cron \ + && make + +RUN cd /tmp/pg_cron \ + && make install + +# --------------------------------------------------------------------------- +# 5. Build pgaudit +# --------------------------------------------------------------------------- +RUN git clone --branch ${PGAUDIT_VERSION} --depth 1 \ + https://github.com/pgaudit/pgaudit.git /tmp/pgaudit + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 install + +# --------------------------------------------------------------------------- +# Clean up build deps from builder layer (keep image lean for COPY) +# --------------------------------------------------------------------------- +RUN apk del .build-deps + + +# ============================================================================= +# Stage 2: Final image +# ============================================================================= +FROM ghcr.io/appscode-images/postgres:18.3-alpine + +# Runtime libraries required by the extensions +RUN apk add --no-cache \ + gdal \ + geos \ + json-c \ + libpq \ + libstdc++ \ + libxml2 \ + pcre2 \ + proj \ + protobuf-c \ + sfcgal + +# Copy compiled extension files from builder +COPY --from=builder /usr/local/lib/postgresql/ /usr/local/lib/postgresql/ +COPY --from=builder /usr/local/share/postgresql/ /usr/local/share/postgresql/ + +# pg_repack ships a client binary as well +COPY --from=builder /usr/local/bin/pg_repack /usr/local/bin/pg_repack \ No newline at end of file diff --git a/ext/18.3/bookworm/Dockerfile b/ext/18.3/bookworm/Dockerfile new file mode 100644 index 0000000000..9e50a327e2 --- /dev/null +++ b/ext/18.3/bookworm/Dockerfile @@ -0,0 +1,169 @@ +# ============================================================================= +# PostgreSQL 18 Bookworm — Custom Image +# Extensions: pgvector 0.8.2, PostGIS 3.6.2, pg_repack 1.5.3, +# pg_cron 1.6.7, pgaudit 18.x +# ============================================================================= + +# ----------------------------------------------------------------------------- +# Stage 1: Builder +# ----------------------------------------------------------------------------- +FROM ghcr.io/appscode-images/postgres:18.3-bookworm AS builder + +# Extension versions pinned to PostgreSQL 18 compatible releases +ENV PGVECTOR_VERSION=0.8.2 +ENV POSTGIS_VERSION=3.6.2 +ENV PG_REPACK_VERSION=1.5.3 +ENV PG_CRON_VERSION=1.6.7 +# pgaudit uses the REL_18_STABLE branch (tracks the latest 18.x patch) +ENV PGAUDIT_VERSION=REL_18_STABLE + +# Ensure pg_config is on PATH +ENV PATH="/usr/lib/postgresql/18/bin:/usr/local/bin:/usr/bin:/bin:${PATH}" + +# --------------------------------------------------------------------------- +# Install build-time dependencies +# --------------------------------------------------------------------------- +RUN apt-get update + +RUN apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + ca-certificates \ + clang \ + cmake \ + curl \ + g++ \ + gawk \ + gcc \ + gettext \ + git \ + libc-dev \ + libcunit1-dev \ + libgdal-dev \ + libgeos-dev \ + libkrb5-dev \ + liblz4-dev \ + libjson-c-dev \ + libnuma-dev \ + libpcre2-dev \ + libpq-dev \ + libproj-dev \ + libprotobuf-c-dev \ + libreadline-dev \ + libsfcgal-dev \ + libxml2-dev \ + libtool \ + llvm-dev \ + make \ + pkg-config \ + postgresql-server-dev-18 \ + protobuf-c-compiler \ + unzip \ + zlib1g-dev + +RUN rm -rf /var/lib/apt/lists/* + +# --------------------------------------------------------------------------- +# 1. Build pgvector +# --------------------------------------------------------------------------- +RUN git clone --branch v${PGVECTOR_VERSION} --depth 1 \ + https://github.com/pgvector/pgvector.git /tmp/pgvector + +RUN cd /tmp/pgvector \ + && make clean + +RUN cd /tmp/pgvector \ + && make + +RUN cd /tmp/pgvector \ + && make install + +# --------------------------------------------------------------------------- +# 2. Build PostGIS +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://github.com/postgis/postgis/archive/${POSTGIS_VERSION}.tar.gz \ + -o /tmp/postgis.tar.gz + +RUN mkdir -p /tmp/postgis \ + && tar --extract --file /tmp/postgis.tar.gz \ + --directory /tmp/postgis --strip-components 1 \ + && rm /tmp/postgis.tar.gz + +RUN cd /tmp/postgis \ + && ./autogen.sh + +RUN cd /tmp/postgis \ + && ./configure --enable-lto + +RUN cd /tmp/postgis \ + && make -j$(nproc) + +RUN cd /tmp/postgis \ + && make install + +# --------------------------------------------------------------------------- +# 3. Build pg_repack +# --------------------------------------------------------------------------- +RUN curl -sSL \ + https://api.pgxn.org/dist/pg_repack/${PG_REPACK_VERSION}/pg_repack-${PG_REPACK_VERSION}.zip \ + -o /tmp/pg_repack.zip + +RUN unzip /tmp/pg_repack.zip -d /tmp \ + && rm /tmp/pg_repack.zip + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make + +RUN cd /tmp/pg_repack-${PG_REPACK_VERSION} \ + && make install + +# --------------------------------------------------------------------------- +# 4. Build pg_cron +# --------------------------------------------------------------------------- +RUN git clone --branch v${PG_CRON_VERSION} --depth 1 \ + https://github.com/citusdata/pg_cron.git /tmp/pg_cron + +RUN cd /tmp/pg_cron \ + && make + +RUN cd /tmp/pg_cron \ + && make install + +# --------------------------------------------------------------------------- +# 5. Build pgaudit +# --------------------------------------------------------------------------- +RUN git clone --branch ${PGAUDIT_VERSION} --depth 1 \ + https://github.com/pgaudit/pgaudit.git /tmp/pgaudit + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 + +RUN cd /tmp/pgaudit \ + && make USE_PGXS=1 install + + +# ============================================================================= +# Stage 2: Final image +# ============================================================================= +FROM ghcr.io/appscode-images/postgres:18.3-bookworm + +# Runtime libraries required by the extensions +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libgdal32 \ + libgeos-c1v5 \ + libjson-c5 \ + libpcre2-8-0 \ + libproj25 \ + libprotobuf-c1 \ + libsfcgal1 \ + libxml2 \ + && rm -rf /var/lib/apt/lists/* + +# Copy compiled extension files from builder +COPY --from=builder /usr/lib/postgresql/18/lib/ /usr/lib/postgresql/18/lib/ +COPY --from=builder /usr/share/postgresql/18/extension/ /usr/share/postgresql/18/extension/ + +# pg_repack ships a client binary as well +COPY --from=builder /usr/lib/postgresql/18/bin/pg_repack /usr/lib/postgresql/18/bin/pg_repack \ No newline at end of file From 6447b6c03d212bb4dae55c4d307ceda91c62400e Mon Sep 17 00:00:00 2001 From: souravbiswassanto Date: Tue, 12 May 2026 16:51:18 +0600 Subject: [PATCH 3/4] Add docker hardened iamges for postgres Signed-off-by: souravbiswassanto --- dhi/16.13/alpine/Dockerfile | 5 +++++ dhi/16.13/bookworm/Dockerfile | 5 +++++ dhi/17.9/alpine/Dockerfile | 5 +++++ dhi/17.9/bookworm/Dockerfile | 5 +++++ dhi/18.3/alpine/Dockerfile | 5 +++++ dhi/18.3/debian/Dockerfile | 4 ++-- 6 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 dhi/16.13/alpine/Dockerfile create mode 100644 dhi/16.13/bookworm/Dockerfile create mode 100644 dhi/17.9/alpine/Dockerfile create mode 100644 dhi/17.9/bookworm/Dockerfile create mode 100644 dhi/18.3/alpine/Dockerfile diff --git a/dhi/16.13/alpine/Dockerfile b/dhi/16.13/alpine/Dockerfile new file mode 100644 index 0000000000..27a629987f --- /dev/null +++ b/dhi/16.13/alpine/Dockerfile @@ -0,0 +1,5 @@ +FROM dhi.io/postgres:16.13-alpine3.22-dev AS builder + +FROM dhi.io/postgres:16.13-alpine3.22 +COPY --from=builder /usr/bin/find /usr/bin/find +COPY --from=builder /usr/bin/grep /usr/bin/grep diff --git a/dhi/16.13/bookworm/Dockerfile b/dhi/16.13/bookworm/Dockerfile new file mode 100644 index 0000000000..eac193b56d --- /dev/null +++ b/dhi/16.13/bookworm/Dockerfile @@ -0,0 +1,5 @@ +FROM dhi.io/postgres:16.13-debian13-dev AS builder + +FROM dhi.io/postgres:16.13-debian13 +COPY --from=builder /usr/bin/find /usr/bin/find +COPY --from=builder /usr/bin/grep /usr/bin/grep diff --git a/dhi/17.9/alpine/Dockerfile b/dhi/17.9/alpine/Dockerfile new file mode 100644 index 0000000000..f6284867a7 --- /dev/null +++ b/dhi/17.9/alpine/Dockerfile @@ -0,0 +1,5 @@ +FROM dhi.io/postgres:17.9-alpine3.22-dev AS builder + +FROM dhi.io/postgres:17.9-alpine3.22 +COPY --from=builder /usr/bin/find /usr/bin/find +COPY --from=builder /usr/bin/grep /usr/bin/grep diff --git a/dhi/17.9/bookworm/Dockerfile b/dhi/17.9/bookworm/Dockerfile new file mode 100644 index 0000000000..f83ec078a3 --- /dev/null +++ b/dhi/17.9/bookworm/Dockerfile @@ -0,0 +1,5 @@ +FROM dhi.io/postgres:17.9-debian13-dev AS builder + +FROM dhi.io/postgres:17.9-debian13 +COPY --from=builder /usr/bin/find /usr/bin/find +COPY --from=builder /usr/bin/grep /usr/bin/grep diff --git a/dhi/18.3/alpine/Dockerfile b/dhi/18.3/alpine/Dockerfile new file mode 100644 index 0000000000..df1f6b35ef --- /dev/null +++ b/dhi/18.3/alpine/Dockerfile @@ -0,0 +1,5 @@ +FROM dhi.io/postgres:18.3-alpine3.22-dev AS builder + +FROM dhi.io/postgres:18.3-alpine3.22 +COPY --from=builder /usr/bin/find /usr/bin/find +COPY --from=builder /usr/bin/grep /usr/bin/grep diff --git a/dhi/18.3/debian/Dockerfile b/dhi/18.3/debian/Dockerfile index 8c463e0b70..3b013827b2 100644 --- a/dhi/18.3/debian/Dockerfile +++ b/dhi/18.3/debian/Dockerfile @@ -1,5 +1,5 @@ -FROM dhi.io/postgres:18-debian13-dev AS builder +FROM dhi.io/postgres:18.3-debian13-dev AS builder -FROM dhi.io/postgres:18-debian13 +FROM dhi.io/postgres:18.3-debian13 COPY --from=builder /usr/bin/find /usr/bin/find COPY --from=builder /usr/bin/grep /usr/bin/grep From f0fc44ac34ae280fcb4e0aaf27040aefa6d19334 Mon Sep 17 00:00:00 2001 From: souravbiswassanto Date: Fri, 7 Aug 2026 20:54:11 +0600 Subject: [PATCH 4/4] Add Percona pg_tde (TDE) Dockerfile for postgres 17.9 bookworm Percona Server for PostgreSQL 17.9 with the pg_tde extension, laid out to match the official postgres:17-bookworm runtime contract (uid/gid 999, binaries under /usr/lib/postgresql/17/bin, upstream docker-entrypoint.sh + gosu, same PGDATA/locale/VOLUME/STOPSIGNAL/EXPOSE). Sourced from https://github.com/kubedb/postgres-docker/tree/release-17.9-percona with the entrypoint donor switched to ghcr.io/appscode-images/postgres:17.9-bookworm and the Percona minor pinned to 2:17.9-1.bookworm so the tag is truthful. Signed-off-by: souravbiswassanto --- tde/17.9/bookworm/Dockerfile | 124 +++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 tde/17.9/bookworm/Dockerfile diff --git a/tde/17.9/bookworm/Dockerfile b/tde/17.9/bookworm/Dockerfile new file mode 100644 index 0000000000..4eceb3f6ee --- /dev/null +++ b/tde/17.9/bookworm/Dockerfile @@ -0,0 +1,124 @@ +# ============================================================================= +# PostgreSQL 17.9 Bookworm — Percona Server for PostgreSQL + pg_tde (TDE) +# Source: https://github.com/kubedb/postgres-docker/tree/release-17.9-percona +# ============================================================================= +# +# Percona Server for PostgreSQL + pg_tde, laid out to match the Docker official +# `postgres:-bookworm` image so it is a drop-in for KubeDB. +# +# Why a dedicated image: pg_tde's `tde_heap` access method requires the Percona +# Server for PostgreSQL fork, not community PostgreSQL. This image installs the +# Percona distribution from Percona's apt repository while keeping the exact same +# runtime contract KubeDB already relies on for `postgres:-bookworm`: +# * a `postgres` user/group at uid/gid 999 +# * server binaries on PATH at /usr/lib/postgresql//bin +# * the official docker-entrypoint.sh + gosu (borrowed from the upstream image) +# * PGDATA, locale, VOLUME, STOPSIGNAL and EXPOSE identical to upstream +# KubeDB overrides the command with its init-container run scripts at runtime, so +# what matters is the layout, the user, and the binaries, all of which match. + +ARG PG_MAJOR=17 + +# Borrow the proven entrypoint scripts and gosu from the appscode-images rebuild +# of the Docker official image so we do not re-implement (and drift from) that +# contract. +FROM ghcr.io/appscode-images/postgres:17.9-bookworm AS upstream + +FROM debian:bookworm-slim + +ARG PG_MAJOR +ENV PG_MAJOR=${PG_MAJOR} +# The exact Percona minor is pinned so the image tag matches the installed server +# version. Find a value with: apt-cache madison percona-postgresql-17 +ARG PG_VERSION=2:17.9-1.bookworm + +LABEL org.opencontainers.image.source="https://github.com/appscode-images/postgres" +LABEL percona.package="Percona Server for PostgreSQL" + +# Match the official image: create the postgres user *before* installing the +# server packages so the package postinst adopts uid/gid 999 instead of a +# distro-assigned id. KubeDB runs the pod as runAsUser 999. +RUN set -eux; \ + groupadd -r postgres --gid=999; \ + useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \ + mkdir -p /var/lib/postgresql; \ + chown -R postgres:postgres /var/lib/postgresql + +# Base tooling + locale (en_US.UTF-8, same as upstream). +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + gnupg \ + lsb-release \ + locales \ + wget \ + ; \ + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8; \ + rm -rf /var/lib/apt/lists/* +ENV LANG=en_US.utf8 + +# Enable Percona's apt repo for the PostgreSQL 17 line, then install the Percona +# server, contrib (pg_stat_statements, etc.) and the pg_tde extension. pg_tde is +# a hard dependency of the server package now, but we name it explicitly so the +# intent (and the build) is unambiguous. `create_main_cluster = false` stops +# postgresql-common from spinning up a throwaway cluster during the build. +RUN set -eux; \ + apt-get update; \ + wget -qO /tmp/percona-release.deb "https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb"; \ + apt-get install -y --no-install-recommends /tmp/percona-release.deb; \ + rm -f /tmp/percona-release.deb; \ + percona-release setup ppg-17; \ + apt-get update; \ + mkdir -p /etc/postgresql-common; \ + echo 'create_main_cluster = false' > /etc/postgresql-common/createcluster.conf; \ + PIN=""; [ -n "${PG_VERSION}" ] && PIN="=${PG_VERSION}"; \ + apt-get install -y --no-install-recommends \ + percona-postgresql-${PG_MAJOR}${PIN} \ + percona-postgresql-client-${PG_MAJOR}${PIN} \ + percona-pg-tde${PG_MAJOR} \ + percona-postgresql-contrib \ + ; \ + rm -rf /var/lib/apt/lists/*; \ + # sanity check: the Percona server and the pg_tde tooling KubeDB needs must be + # present and on PATH. KubeDB uses pg_tde_basebackup for replica seeding, + # pg_tde_rewind for failback, and pg_tde_waldump / pg_tde_resetwal in the + # coordinator's failback WAL handling on an encrypted cluster (the plain tools + # cannot read encrypted WAL). Missing any of these silently breaks TDE HA, so + # assert them at build time. + /usr/lib/postgresql/${PG_MAJOR}/bin/postgres --version; \ + for _bin in pg_tde_basebackup pg_tde_rewind pg_tde_waldump pg_tde_resetwal; do \ + test -x "/usr/lib/postgresql/${PG_MAJOR}/bin/${_bin}" \ + || { echo "FATAL: required pg_tde tool ${_bin} not found in the image"; exit 1; }; \ + done + +# Same PATH / PGDATA / run-dir setup as the official image. KubeDB overrides +# PGDATA to its own mount at runtime; this default keeps the image usable +# standalone. +ENV PATH=/usr/lib/postgresql/${PG_MAJOR}/bin:$PATH +ENV PGDATA=/var/lib/postgresql/data +RUN set -eux; \ + install --verbose --directory --owner postgres --group postgres --mode 1777 /var/run/postgresql; \ + install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA" + +VOLUME /var/lib/postgresql/data + +# Reuse the upstream entrypoint contract verbatim (entrypoint + initdb helpers + +# gosu) so behaviour is identical to postgres:-bookworm. +COPY --from=upstream /usr/local/bin/gosu /usr/local/bin/gosu +COPY --from=upstream /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh +COPY --from=upstream /usr/local/bin/docker-ensure-initdb.sh /usr/local/bin/docker-ensure-initdb.sh +RUN set -eux; \ + ln -sfT docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh; \ + gosu --version; \ + gosu nobody true +ENTRYPOINT ["docker-entrypoint.sh"] + +# postgres uses SIGINT for a fast shutdown; match upstream so orchestrators stop +# it cleanly. +STOPSIGNAL SIGINT +EXPOSE 5432 + +USER 999 +CMD ["postgres"]