A production-grade, self-updating PostgreSQL container image purpose-built for spatial data (PostGIS) and AI/LLM vector embeddings (pgvector).
This repository heavily prioritizes security, automation, and performance by utilizing the official Debian Bookworm base and automating patch management via GitHub Actions and Dependabot.
- PostgreSQL 18 LTS: Built on the official
postgres:18-bookwormbase. - Pre-compiled Extensions: Uses the official PGDG APT repository to install
postgisandpgvectornatively (no brittle source compilations). - Auto-Initialization: Extensions are automatically created in the default database upon first boot.
- Zero-Touch Maintenance: Dependabot listens for minor releases and security patches to the base image and automatically triggers our CI/CD pipeline to rebuild and push the updated image.
- GHCR Native: Hosted on the GitHub Container Registry (
ghcr.io) for high availability and zero rate-limiting during CI/CD pulls.
You can pull the image directly from the GitHub Container Registry.
Create a docker-compose.yml file:
services:
db:
image: ghcr.io/devxhub/postgres:18restart: alwaysenvironment:
POSTGRES_USER: myuserPOSTGRES_PASSWORD: mysecretpasswordPOSTGRES_DB: mydatabaseports:
- "5432:5432"volumes:
- pgdata:/var/lib/postgresql/datavolumes:
pgdata:
Run the stack:
docker-compose up -d
Once the database is running, you can connect and verify the extensions are active:
SELECT extname, extversion FROM pg_extension;
-- Expected output should include 'postgis' and 'vector'This project is maintained automatically via GitHub Actions:
- Dependabot monitors Docker Hub for exact SHA digest updates to
postgres:18-bookworm. - When a security patch or minor update (e.g.,
18.x) is released, Dependabot opens a PR. - GitHub Actions runs a dry-run build using Buildx to ensure extension compatibility.
- Upon merge, the workflow tags the new image (
18,latest, and<git-sha>) and pushes it toghcr.io.
Note on Alpine: We strictly use the Debian (
bookworm) base image. Alpine (musl) is notorious for introducing floating-point geometry rounding errors in PostGIS, compatibility issues with pgvector C dependencies, and massive CI/CD bottlenecks since it lacks pre-compiled PGDG APT packages.
This pipeline is pinned to PostgreSQL 18. If a new major version (e.g., PostgreSQL 19) is released, this pipeline will not automatically upgrade.
PostgreSQL data files are not binary-compatible across major versions. Major upgrades require manual intervention using pg_upgrade or a dump/restore strategy to safely migrate the existing pgdata volume.