Files
cnpg-postgres-containers/Dockerfile
Jonathan Gonzalez V. 23e1fa6181 chore: add support for PostgreSQL beta versions (#191)
Now bake supports beta versions for the list and the building of the images

Closes #190

Signed-off-by: Jonathan Gonzalez V <jonathan.gonzalez@enterprisedb.com>
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
Co-authored-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
2025-05-23 15:14:49 +02:00

32 lines
1.2 KiB
Docker

ARG BASE=debian:12.11-slim
FROM $BASE AS minimal
ARG PG_VERSION
ARG PG_MAJOR
ENV PATH=$PATH:/usr/lib/postgresql/$PG_MAJOR/bin
RUN apt-get update && \
apt-get install -y --no-install-recommends postgresql-common ca-certificates gnupg && \
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y -c "${PG_MAJOR}" && \
apt-get install -y --no-install-recommends -o Dpkg::::="--force-confdef" -o Dpkg::::="--force-confold" postgresql-common && \
sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf && \
apt-get install -y --no-install-recommends \
-o Dpkg::::="--force-confdef" -o Dpkg::::="--force-confold" "postgresql-${PG_MAJOR}=${PG_VERSION}*" && \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*
RUN usermod -u 26 postgres
USER 26
FROM minimal AS standard
ARG EXTENSIONS
USER root
RUN apt-get update && \
apt-get install -y --no-install-recommends locales-all ${EXTENSIONS} && \
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false && \
rm -rf /var/lib/apt/lists/* /var/cache/* /var/log/*
USER 26