diff --git a/Dockerfile.pg b/Dockerfile.pg index 225043d..2cafce0 100644 --- a/Dockerfile.pg +++ b/Dockerfile.pg @@ -1,32 +1,18 @@ # Custom arm64 PostgreSQL 16 image with PostGIS 3 + TimescaleDB 2. -# Timescale's published timescaledb-postgis image is amd64-only, so we build -# our own on Debian 12 (arm64). The app only uses standard SQL types (UUID, -# JSON, TSVECTOR, float lat/lon), so pg16 is fully sufficient. -FROM debian:12 - -ENV DEBIAN_FRONTEND=noninteractive +# Based on the official postgres:16 image so POSTGRES_USER/DB/PASSWORD env +# vars and host-auth (md5) work out of the box. Timescale's published +# timescaledb-postgis image is amd64-only, so we install the extensions here. +FROM postgres:16 +# Install TimescaleDB + PostGIS from the respective apt repos. RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates curl gnupg lsb-release && \ - install -d /usr/share/postgresql-common/pgdg && \ - curl -fsSL -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc \ - https://www.postgresql.org/media/keys/ACCC4CF8.asc && \ - echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] \ - https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" \ - > /etc/apt/sources.list.d/pgdg.list && \ curl -fsSL https://packagecloud.io/install/repositories/timescale/timescaledb/script.deb.sh | bash && \ apt-get update && apt-get install -y --no-install-recommends \ - postgresql-16 postgresql-16-postgis-3 timescaledb-2-postgresql-16 && \ - # load TimescaleDB at startup - sed -ri "s/^#?shared_preload_libraries = .*/shared_preload_libraries = 'timescaledb'/" \ - /etc/postgresql/16/main/postgresql.conf && \ + postgresql-16-postgis-3 timescaledb-2-postgresql-16 && \ + # Load TimescaleDB at startup via a drop-in (keeps official entrypoint intact). + echo "shared_preload_libraries = 'timescaledb'" > /etc/postgresql/16/main/conf.d/timescaledb.conf && \ rm -rf /var/lib/apt/lists/* -# Match the official postgres image layout so volume mounts/behavior are familiar. -VOLUME ["/var/lib/postgresql/data"] -EXPOSE 5432 - -# Run as the postgres user (uid 999) like the official image. -USER postgres -ENV PGDATA=/var/lib/postgresql/data -ENTRYPOINT ["/usr/lib/postgresql/16/bin/postgres", "-D", "/etc/postgresql/16/main", "-c", "config_file=/etc/postgresql/16/main/postgresql.conf"] +# The official postgres entrypoint remains the CMD and handles +# POSTGRES_USER / POSTGRES_DB / POSTGRES_PASSWORD and pg_hba setup.