From d5f4e38b24bb6eb18f083570299d2aa174de44c3 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Fri, 15 May 2026 21:35:58 +0000 Subject: [PATCH 1/2] feat: add pg_cron and pg_partman extensions - pg_cron v1.6.7: job scheduler for periodic tasks - pg_partman v5.4.3: partition management - Add both to shared_preload_libraries - Update README with new extensions - Update Makefile test target --- Dockerfile | 24 ++++++++++++++++++++---- Makefile | 2 ++ README.md | 4 ++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1fe08b6..7c34118 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ -# Lean PostgreSQL image with pgvector, PostGIS, and pg_textsearch +# Lean PostgreSQL image with pgvector, PostGIS, pg_textsearch, pg_cron, and pg_partman # Multi-stage build - all toolchains discarded, only artifacts kept ARG PG_VERSION=18 ARG PGVECTOR_VERSION=0.8.2 ARG POSTGIS_VERSION=3.6.2 ARG PG_TEXTSEARCH_VERSION=0.6.1 +ARG PG_CRON_VERSION=1.6.7 +ARG PG_PARTMAN_VERSION=5.4.3 ############################################# # Stage 1: Build extensions @@ -14,6 +16,8 @@ FROM postgres:${PG_VERSION}-alpine AS builder ARG PGVECTOR_VERSION ARG POSTGIS_VERSION ARG PG_TEXTSEARCH_VERSION +ARG PG_CRON_VERSION +ARG PG_PARTMAN_VERSION RUN apk add --no-cache \ git \ @@ -59,6 +63,18 @@ RUN git clone --branch v${PG_TEXTSEARCH_VERSION} --depth 1 https://github.com/ti make -j$(nproc) && \ make install +# pg_cron (job scheduler) +RUN git clone --branch v${PG_CRON_VERSION} --depth 1 https://github.com/citusdata/pg_cron.git && \ + cd pg_cron && \ + make -j$(nproc) && \ + make install + +# pg_partman (partition management) +RUN git clone --branch v${PG_PARTMAN_VERSION} --depth 1 https://github.com/pgpartman/pg_partman.git && \ + cd pg_partman && \ + make -j$(nproc) && \ + make install + ############################################# # Stage 2: Final lean runtime image ############################################# @@ -78,8 +94,8 @@ RUN apk add --no-cache \ COPY --from=builder /usr/local/lib/postgresql/ /usr/local/lib/postgresql/ COPY --from=builder /usr/local/share/postgresql/ /usr/local/share/postgresql/ -# Preload pg_textsearch so CREATE EXTENSION works without manual config -RUN echo "shared_preload_libraries = 'pg_textsearch'" >> /usr/local/share/postgresql/postgresql.conf.sample +# Preload extensions that require shared_preload_libraries +RUN echo "shared_preload_libraries = 'pg_textsearch,pg_cron,pg_partman_bgw'" >> /usr/local/share/postgresql/postgresql.conf.sample LABEL org.opencontainers.image.source="https://github.com/constructive-io/docker" -LABEL org.opencontainers.image.description="PostgreSQL 18 with pgvector, PostGIS, and pg_textsearch" +LABEL org.opencontainers.image.description="PostgreSQL 18 with pgvector, PostGIS, pg_textsearch, pg_cron, and pg_partman" diff --git a/Makefile b/Makefile index 2b399f4..3b2dfce 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,8 @@ test: build CREATE EXTENSION vector; \ CREATE EXTENSION postgis; \ CREATE EXTENSION pg_textsearch; \ + CREATE EXTENSION pg_cron; \ + CREATE EXTENSION pg_partman; \ SELECT 'all extensions OK';" @docker stop $(CONTAINER_NAME)-test > /dev/null @docker rm $(CONTAINER_NAME)-test > /dev/null diff --git a/README.md b/README.md index 0a73de4..3d7c92a 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ Lean PostgreSQL 18 image with essential extensions for modern applications. | [pgvector](https://github.com/pgvector/pgvector) | Vector similarity search for embeddings | | [PostGIS](https://postgis.net/) | Spatial and geographic data | | [pg_textsearch](https://www.tigerdata.com/docs/use-timescale/latest/extensions/pg-textsearch) | BM25 full-text search | +| [pg_cron](https://github.com/citusdata/pg_cron) | Job scheduler for periodic tasks | +| [pg_partman](https://github.com/pgpartman/pg_partman) | Partition management | ## Usage @@ -34,6 +36,8 @@ Enable extensions as needed: CREATE EXTENSION vector; CREATE EXTENSION postgis; CREATE EXTENSION pg_textsearch; +CREATE EXTENSION pg_cron; +CREATE EXTENSION pg_partman; ``` ## Build From 39e5b9ce7e4fe63faacafd667b5aa2dea0d0756c Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Fri, 15 May 2026 22:25:47 +0000 Subject: [PATCH 2/2] docs: update README with versions, fix image refs, bump pg_textsearch to 1.2.0 - Add version column to extensions table - Update pg_textsearch from 0.6.1 to 1.2.0 - Fix image name to match CI workflow (ghcr.io/constructive-io/docker/postgres-plus) - Update pg_textsearch link to GitHub repo - Update 'Building manually' section with correct image name --- Dockerfile | 2 +- README.md | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7c34118..8ebf47d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ARG PG_VERSION=18 ARG PGVECTOR_VERSION=0.8.2 ARG POSTGIS_VERSION=3.6.2 -ARG PG_TEXTSEARCH_VERSION=0.6.1 +ARG PG_TEXTSEARCH_VERSION=1.2.0 ARG PG_CRON_VERSION=1.6.7 ARG PG_PARTMAN_VERSION=5.4.3 diff --git a/README.md b/README.md index 3d7c92a..3fac3ad 100644 --- a/README.md +++ b/README.md @@ -8,26 +8,26 @@ Lean PostgreSQL 18 image with essential extensions for modern applications. ## Extensions -| Extension | Description | -|-----------|-------------| -| [pgvector](https://github.com/pgvector/pgvector) | Vector similarity search for embeddings | -| [PostGIS](https://postgis.net/) | Spatial and geographic data | -| [pg_textsearch](https://www.tigerdata.com/docs/use-timescale/latest/extensions/pg-textsearch) | BM25 full-text search | -| [pg_cron](https://github.com/citusdata/pg_cron) | Job scheduler for periodic tasks | -| [pg_partman](https://github.com/pgpartman/pg_partman) | Partition management | +| Extension | Version | Description | +|-----------|---------|-------------| +| [pgvector](https://github.com/pgvector/pgvector) | 0.8.2 | Vector similarity search for embeddings | +| [PostGIS](https://postgis.net/) | 3.6.2 | Spatial and geographic data | +| [pg_textsearch](https://github.com/timescale/pg_textsearch) | 1.2.0 | BM25 full-text search | +| [pg_cron](https://github.com/citusdata/pg_cron) | 1.6.7 | Job scheduler for periodic tasks | +| [pg_partman](https://github.com/pgpartman/pg_partman) | 5.4.3 | Partition management | ## Usage ```bash # Pull the image -docker pull ghcr.io/constructive-io/docker:latest +docker pull ghcr.io/constructive-io/docker/postgres-plus:latest # Run docker run -d \ --name postgres \ -e POSTGRES_PASSWORD=secret \ -p 5432:5432 \ - ghcr.io/constructive-io/docker:latest + ghcr.io/constructive-io/docker/postgres-plus:latest ``` Enable extensions as needed: @@ -55,7 +55,7 @@ make clean # Remove image ```bash docker buildx build \ --platform linux/amd64,linux/arm64 \ - -t docker.io/constructiveio/postgres:18 \ - -t docker.io/constructiveio/postgres:latest \ + -t ghcr.io/constructive-io/docker/postgres-plus:18 \ + -t ghcr.io/constructive-io/docker/postgres-plus:latest \ --push . ```