Files
computer-playbook/roles/svc-db-postgres/templates/Dockerfile.j2
kevinveenbirkenbach 30417d2515 fix(svc-db-postgres): build on the official multi-arch postgres 18 image
postgis/postgis publishes amd64 only, so every postgres consumer failed
on arm64. The official postgres image serves both architectures and
already ships the contrib extensions bloom, pg_trgm and unaccent.

PostGIS moves into the postgres_libraries registry and is installed from
PGDG (postgresql-18-postgis-3) only for a consumer that declares it as
an extension, which is mobilizon alone. apt update reads every source
list again, because the PostGIS package depends on GDAL from Debian
main, which a PGDG-only update left without an install candidate.

Postgres 18 keeps its cluster in /var/lib/postgresql/18/docker and its
entrypoint treats a volume at the former /var/lib/postgresql/data as an
old database, so the central and the dedicated data volume both mount at
/var/lib/postgresql. Existing 17 clusters are not migrated: their data
directory trips the entrypoint's old-data check and the container
refuses to start.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit f78ebe46a4)
2026-10-01 22:19:09 +02:00

28 lines
993 B
Docker

FROM {{ POSTGRES_IMAGE }}:{{ POSTGRES_VERSION }}
{% if POSTGRES_LIBRARIES | length > 0 %}
RUN rm -rf /var/lib/apt/lists/* \
&& apt-get -o Acquire::Retries=3 update \
&& apt-get -o Acquire::Retries=3 install -y --no-install-recommends \
{% for lib in POSTGRES_LIBRARIES %}
postgresql-{{ POSTGRES_VERSION_MAJOR }}-{{ lib.apt_package }} \
{% endfor %}
&& rm -rf /var/lib/apt/lists/*
{% endif %}
COPY <<'BOOT_ENTRYPOINT_EOF' /usr/local/bin/boot-entrypoint.sh
{{ lookup('file', lookup('path_absolute', 'roles/svc-db-postgres/files/shell/boot-entrypoint.sh')) }}
BOOT_ENTRYPOINT_EOF
RUN chmod +x /usr/local/bin/boot-entrypoint.sh
ENTRYPOINT ["boot-entrypoint.sh"]
CMD ["postgres"]
# nocheck: healthcheck-timing-override a first initdb of a large cluster outlasts the ten minute window
HEALTHCHECK --interval=2m \
--timeout=5s \
--start-period=15m \
--retries=5 \
--start-interval=5s \
CMD pg_isready -h 127.0.0.1 -U postgres || exit 1