This repository builds PostgreSQL extension container images for CloudNativePG using the same base image pattern and a minimal packaging layout.
The repo currently includes two extension images:
cronviacron/Dockerfileforpg_crontimescaledbviatimescaledb/Dockerfilefor TimescaleDB
- Docker Engine
- Docker Buildx (recommended for modern builds)
- Access to a container registry such as GitHub Container Registry (
ghcr.io) - For GitHub Actions usage: a repository with
packages: writepermission and a validGITHUB_TOKEN
Each Dockerfile follows the same pattern:
- Start from
ghcr.io/cloudnative-pg/postgresql:<major>-minimal-trixie - Install the extension package in a builder stage
- Copy only the runtime libraries, share files, and license metadata into a final
scratchimage
This keeps the final image minimal and compatible with CloudNativePG-style extension containers.
Run the builds from the repository root.
docker build \
-f cron/Dockerfile \
-t ghcr.io/<your-user>/postgresql-ext-cron:18-1.6.7 \
--build-arg PG_MAJOR=18 \
--build-arg EXT_VERSION=1.6.7 \
.You can also use a local tag:
docker build \
-f cron/Dockerfile \
-t local/postgresql-ext-cron:18-1.6.7 \
--build-arg PG_MAJOR=18 \
--build-arg EXT_VERSION=1.6.7 \
.If you want to push to GHCR after building:
docker push ghcr.io/<your-user>/postgresql-ext-cron:18-1.6.7docker build \
-f timescaledb/Dockerfile \
-t ghcr.io/<your-user>/postgresql-ext-timescaledb:18-2.29.2 \
--build-arg PG_MAJOR=18 \
--build-arg EXT_VERSION=2.29.2 \
.Or with a local tag:
docker build \
-f timescaledb/Dockerfile \
-t local/postgresql-ext-timescaledb:18-2.29.2 \
--build-arg PG_MAJOR=18 \
--build-arg EXT_VERSION=2.29.2 \
.Then push it:
docker push ghcr.io/<your-user>/postgresql-ext-timescaledb:18-2.29.2The Dockerfiles default to
PG_MAJOR=18and their own default extension versions, but you can override them with--build-argto match your target PostgreSQL version or extension package version.
The repository includes a workflow at .github/workflows/build.yaml that can build and publish either extension image.
- Open GitHub Actions in the repository.
- Select the
Build and Pushworkflow. - Click
Run workflow. - Supply the required inputs:
ext_name:cronortimescaledbpg_major: PostgreSQL major version, for example18ext_version: extension package version, for example1.6.7or2.29.2
ext_name: cron
pg_major: 18
ext_version: 1.6.7
This produces tags like:
ghcr.io/<owner>/postgresql-ext-cron:18-1.6.7ghcr.io/<owner>/postgresql-ext-cron:18ghcr.io/<owner>/postgresql-ext-cron:latest
ext_name: timescaledb
pg_major: 18
ext_version: 2.29.2
This produces tags like:
ghcr.io/<owner>/postgresql-ext-timescaledb:18-2.29.2ghcr.io/<owner>/postgresql-ext-timescaledb:18ghcr.io/<owner>/postgresql-ext-timescaledb:latest
The workflow uses docker/build-push-action with:
context: .file: ./${{ inputs.ext_name }}/Dockerfilepush: truebuild-args:PG_MAJOR=${{ inputs.pg_major }}EXT_VERSION=${{ inputs.ext_version }}
This means the same Dockerfile build logic is reused for both custom images, while the action handles registry tagging and publishing automatically.
- The
cronimage installspostgresql-${PG_MAJOR}-cronfrom the PostgreSQL package repository. - The
timescaledbimage installs the TimescaleDB package via the official Timescale package repository and then packages only the runtime files needed by PostgreSQL. - Both images are designed to be used as extension images for CloudNativePG deployments, with the required license and shared object files copied into the final image.