32 lines
1.7 KiB
Text
32 lines
1.7 KiB
Text
# 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
|
|
|
|
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 && \
|
|
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"]
|