26 lines
1.4 KiB
Text
26 lines
1.4 KiB
Text
|
|
# Thermograph database image: PostgreSQL 18 with pg_duckdb.
|
||
|
|
#
|
||
|
|
# pg_duckdb embeds DuckDB inside Postgres, which lets the DB container read the
|
||
|
|
# app's Parquet climate cache directly for ad-hoc analytics:
|
||
|
|
#
|
||
|
|
# SELECT * FROM read_parquet('/parquet/1026_-2857.parquet');
|
||
|
|
#
|
||
|
|
# Why FROM the official pg_duckdb image instead of `FROM postgres:18` + compile:
|
||
|
|
# pg_duckdb links a full DuckDB build, so compiling it from source in this
|
||
|
|
# Dockerfile would mean pulling the DuckDB toolchain and a long, fragile build.
|
||
|
|
# The maintainers (duckdb/pg_duckdb, MotherDuck) publish an official PG18 image
|
||
|
|
# that is genuine PostgreSQL 18.1 on Debian 12 bookworm -- the exact same base
|
||
|
|
# as the official `postgres:18` image, using the standard postgres
|
||
|
|
# docker-entrypoint.sh. So POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB /
|
||
|
|
# PGDATA / /docker-entrypoint-initdb.d / pg_isready all behave identically to
|
||
|
|
# `postgres:18`; this is a drop-in replacement for the compose `db` service.
|
||
|
|
#
|
||
|
|
# Pinned to a specific patch tag (not 18-main) for reproducible builds.
|
||
|
|
FROM pgduckdb/pgduckdb:18-v1.1.1
|
||
|
|
|
||
|
|
# Bake the parquet init script so the image enables the extension on first init
|
||
|
|
# even without the compose bind mount. It is CREATE EXTENSION IF NOT EXISTS, so
|
||
|
|
# it is idempotent with the base image's own 0001-install-pg_duckdb.sql.
|
||
|
|
# Build context is the repo root (see deploy/db/README.md for the compose snippet).
|
||
|
|
COPY deploy/db/init/ /docker-entrypoint-initdb.d/
|