postgres (latest)

Published 2026-11-01 14:39:55 +01:00 by MHE in openso/postgres

Installation

docker pull git.openso.de/openso/postgres:latest
sha256:843f84eb1adaa9ec064e5829f2243c570dc18d408cc4c02d01dea03416628b5d

Image layers

# debian.sh --arch 'amd64' out/ 'trixie' '@1793059200'
RUN /bin/sh -c set -eux; groupadd -r postgres --gid=999; useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql # buildkit
RUN /bin/sh -c set -ex; apt-get update; apt-get install -y --no-install-recommends gnupg less ; rm -rf /var/lib/apt/lists/* # buildkit
ENV GOSU_VERSION=1.19
RUN /bin/sh -c set -eux; savedAptMark="$(apt-mark showmanual)"; apt-get update; apt-get install -y --no-install-recommends ca-certificates wget; rm -rf /var/lib/apt/lists/*; dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; export GNUPGHOME="$(mktemp -d)"; gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; gpgconf --kill all; rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; apt-mark auto '.*' > /dev/null; [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark > /dev/null; apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; chmod +x /usr/local/bin/gosu; gosu --version; gosu nobody true # buildkit
RUN /bin/sh -c set -eux; if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; fi; apt-get update; apt-get install -y --no-install-recommends locales; rm -rf /var/lib/apt/lists/*; echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen; locale-gen; locale -a | grep 'en_US.utf8' # buildkit
ENV LANG=en_US.utf8
RUN /bin/sh -c set -eux; apt-get update; apt-get install -y --no-install-recommends libnss-wrapper xz-utils zstd ; rm -rf /var/lib/apt/lists/* # buildkit
RUN /bin/sh -c mkdir /docker-entrypoint-initdb.d # buildkit
RUN /bin/sh -c set -ex; key='B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8'; export GNUPGHOME="$(mktemp -d)"; mkdir -p /usr/local/share/keyrings/; gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; gpg --batch --export --armor "$key" > /usr/local/share/keyrings/postgres.gpg.asc; gpgconf --kill all; rm -rf "$GNUPGHOME" # buildkit
ENV PG_MAJOR=18
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/18/bin
ENV PG_VERSION=18.6-1.pgdg13+2
RUN /bin/sh -c set -ex; export PYTHONDONTWRITEBYTECODE=1; dpkgArch="$(dpkg --print-architecture)"; aptRepo="[ signed-by=/usr/local/share/keyrings/postgres.gpg.asc ] http://apt.postgresql.org/pub/repos/apt trixie-pgdg main $PG_MAJOR"; case "$dpkgArch" in amd64 | arm64 | loong64 | ppc64el) echo "deb $aptRepo" > /etc/apt/sources.list.d/pgdg.list; apt-get update; ;; *) echo "deb-src $aptRepo" > /etc/apt/sources.list.d/pgdg.list; savedAptMark="$(apt-mark showmanual)"; tempDir="$(mktemp -d)"; cd "$tempDir"; apt-get update; apt-get install -y --no-install-recommends dpkg-dev; echo "deb [ trusted=yes ] file://$tempDir ./" > /etc/apt/sources.list.d/temp.list; _update_repo() { dpkg-scanpackages . > Packages; apt-get -o Acquire::GzipIndexes=false update; }; _update_repo; nproc="$(nproc)"; export DEB_BUILD_OPTIONS="nocheck parallel=$nproc"; apt-get build-dep -y postgresql-common-dev; apt-get source --compile postgresql-common-dev; _update_repo; apt-get build-dep -y "postgresql-$PG_MAJOR=$PG_VERSION"; apt-get source --compile "postgresql-$PG_MAJOR=$PG_VERSION"; apt-mark showmanual | xargs apt-mark auto > /dev/null; apt-mark manual $savedAptMark; ls -lAFh; _update_repo; grep '^Package: ' Packages; cd /; ;; esac; apt-get install -y --no-install-recommends postgresql-common; sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf; apt-get install -y --no-install-recommends "postgresql-$PG_MAJOR=$PG_VERSION" ; if apt-get install -s "postgresql-$PG_MAJOR-jit" > /dev/null 2>&1; then apt-get install -y --no-install-recommends "postgresql-$PG_MAJOR-jit=$PG_VERSION"; fi; rm -rf /var/lib/apt/lists/*; if [ -n "$tempDir" ]; then apt-get purge -y --auto-remove; rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; fi; find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; postgres --version # buildkit
RUN /bin/sh -c set -eux; dpkg-divert --add --rename --divert "/usr/share/postgresql/postgresql.conf.sample.dpkg" "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample"; cp -v /usr/share/postgresql/postgresql.conf.sample.dpkg /usr/share/postgresql/postgresql.conf.sample; ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/"; sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample; grep -F "listen_addresses = '*'" /usr/share/postgresql/postgresql.conf.sample # buildkit
RUN /bin/sh -c install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql # buildkit
ENV PGDATA=/var/lib/postgresql/18/docker
VOLUME [/var/lib/postgresql]
COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/ # buildkit
RUN /bin/sh -c ln -sT docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh # buildkit
ENTRYPOINT ["docker-entrypoint.sh"]
STOPSIGNAL SIGINT
EXPOSE map[5432/tcp:{}]
CMD ["postgres"]
ARG POSTGRES_PG_SEARCH_VERSION=0.26.4
ARG POSTGRES_VECTORCHORD_VERSION=1.1.1
LABEL maintainer=openso
SHELL [/bin/bash -o pipefail -c]
RUN |2 POSTGRES_PG_SEARCH_VERSION=0.26.4 POSTGRES_VECTORCHORD_VERSION=1.1.1 /bin/bash -o pipefail -c set -euxo pipefail; PG_MAJOR="$(pg_config --version | awk '{print $2}' | cut -d. -f1)"; [ "${PG_MAJOR}" = "18" ] || { echo "Expected PostgreSQL 18, got ${PG_MAJOR}" >&2; exit 1; }; PG_SEARCH_VERSION="${POSTGRES_PG_SEARCH_VERSION#v}"; printf '%s' "${PG_SEARCH_VERSION}" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z]+)*$' || { echo "Invalid pg_search version pin: ${POSTGRES_PG_SEARCH_VERSION}" >&2; exit 1; }; apt-get update; apt-get install -y --no-install-recommends ca-certificates=20250419+deb13u1 curl=8.14.1-2+deb13u7 jq=1.7.1-6+deb13u4 postgresql-18-pgvector=0.8.7-1.pgdg13+1; ARCH="$(dpkg --print-architecture)"; DEB_DIST="$(awk -F= '$1=="VERSION_CODENAME" {print $2}' /etc/os-release)"; RELEASE_API="https://api.github.com/repos/paradedb/paradedb/releases/tags/v${PG_SEARCH_VERSION}"; RELEASE_METADATA="$(mktemp)"; curl --proto '=https' --proto-redir '=https' --tlsv1.2 --fail --silent --show-error --location --retry 5 --retry-all-errors --retry-max-time 120 --connect-timeout 15 --max-time 120 "${RELEASE_API}" -o "${RELEASE_METADATA}"; PG_SEARCH_RELEASE="$(jq -er '.tag_name' "${RELEASE_METADATA}")"; [ "${PG_SEARCH_RELEASE}" = "v${PG_SEARCH_VERSION}" ] || { echo "Resolved unexpected pg_search release: ${PG_SEARCH_RELEASE}" >&2; exit 1; }; PG_SEARCH_ASSET_NAME="postgresql-${PG_MAJOR}-pg-search_${PG_SEARCH_VERSION}-1PARADEDB-${DEB_DIST}_${ARCH}.deb"; PG_SEARCH_ASSET="$(jq -cer --arg asset "${PG_SEARCH_ASSET_NAME}" '[.assets[] | select(.name == $asset)] | if length == 1 then .[0] else error("missing or duplicate release asset") end' "${RELEASE_METADATA}")"; PG_SEARCH_URL="$(printf '%s' "${PG_SEARCH_ASSET}" | jq -er '.browser_download_url')"; PG_SEARCH_DIGEST="$(printf '%s' "${PG_SEARCH_ASSET}" | jq -er '.digest')"; EXPECTED_URL="https://github.com/paradedb/paradedb/releases/download/${PG_SEARCH_RELEASE}/${PG_SEARCH_ASSET_NAME}"; [ "${PG_SEARCH_URL}" = "${EXPECTED_URL}" ] || { echo "Unexpected official pg_search asset URL: ${PG_SEARCH_URL}" >&2; exit 1; }; printf '%s' "${PG_SEARCH_DIGEST}" | grep -Eq '^sha256:[0-9a-f]{64}$' || { echo "Missing or malformed official SHA256 digest for ${PG_SEARCH_ASSET_NAME}" >&2; exit 1; }; curl --proto '=https' --proto-redir '=https' --tlsv1.2 --fail --silent --show-error --location --retry 5 --retry-all-errors --retry-max-time 300 --connect-timeout 15 --max-time 300 "${PG_SEARCH_URL}" -o /tmp/pg_search.deb; printf '%s %s\n' "${PG_SEARCH_DIGEST#sha256:}" /tmp/pg_search.deb | sha256sum -c -; printf 'Installing pg_search %s from %s with verified %s\n' "${PG_SEARCH_RELEASE}" "${PG_SEARCH_ASSET_NAME}" "${PG_SEARCH_DIGEST}"; apt-get install -y --no-install-recommends /tmp/pg_search.deb; VCHORD_VERSION="${POSTGRES_VECTORCHORD_VERSION#v}"; printf '%s' "${VCHORD_VERSION}" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z]+)*$' || { echo "Invalid VectorChord version pin: ${POSTGRES_VECTORCHORD_VERSION}" >&2; exit 1; }; VCHORD_API="https://api.github.com/repos/supervc-stack/VectorChord/releases/tags/${VCHORD_VERSION}"; VCHORD_METADATA="$(mktemp)"; curl --proto '=https' --proto-redir '=https' --tlsv1.2 --fail --silent --show-error --location --retry 5 --retry-all-errors --retry-max-time 120 --connect-timeout 15 --max-time 120 "${VCHORD_API}" -o "${VCHORD_METADATA}"; VCHORD_RELEASE="$(jq -er '.tag_name' "${VCHORD_METADATA}")"; [ "${VCHORD_RELEASE}" = "${VCHORD_VERSION}" ] || { echo "Resolved unexpected VectorChord release: ${VCHORD_RELEASE}" >&2; exit 1; }; VCHORD_ASSET_NAME="postgresql-${PG_MAJOR}-vchord_${VCHORD_VERSION}-1_${ARCH}.deb"; VCHORD_ASSET="$(jq -cer --arg asset "${VCHORD_ASSET_NAME}" '[.assets[] | select(.name == $asset)] | if length == 1 then .[0] else error("missing or duplicate release asset") end' "${VCHORD_METADATA}")"; VCHORD_URL="$(printf '%s' "${VCHORD_ASSET}" | jq -er '.browser_download_url')"; VCHORD_DIGEST="$(printf '%s' "${VCHORD_ASSET}" | jq -er '.digest')"; VCHORD_EXPECTED_URL="https://github.com/supervc-stack/VectorChord/releases/download/${VCHORD_RELEASE}/${VCHORD_ASSET_NAME}"; [ "${VCHORD_URL}" = "${VCHORD_EXPECTED_URL}" ] || { echo "Unexpected official VectorChord asset URL: ${VCHORD_URL}" >&2; exit 1; }; printf '%s' "${VCHORD_DIGEST}" | grep -Eq '^sha256:[0-9a-f]{64}$' || { echo "Missing or malformed official SHA256 digest for ${VCHORD_ASSET_NAME}" >&2; exit 1; }; curl --proto '=https' --proto-redir '=https' --tlsv1.2 --fail --silent --show-error --location --retry 5 --retry-all-errors --retry-max-time 300 --connect-timeout 15 --max-time 300 "${VCHORD_URL}" -o /tmp/vchord.deb; printf '%s %s\n' "${VCHORD_DIGEST#sha256:}" /tmp/vchord.deb | sha256sum -c -; printf 'Installing VectorChord %s from %s with verified %s\n' "${VCHORD_RELEASE}" "${VCHORD_ASSET_NAME}" "${VCHORD_DIGEST}"; apt-get install -y --no-install-recommends /tmp/vchord.deb; apt-get purge -y --auto-remove curl jq; rm -f "${RELEASE_METADATA}" "${VCHORD_METADATA}"; rm -rf /tmp/pg_search.deb /tmp/vchord.deb /var/lib/apt/lists/* # buildkit
COPY init_extensions.postgresql.sh /docker-entrypoint-initdb.d/init_extensions.sh # buildkit
COPY entrypoint.postgresql.sh /usr/local/bin/entrypoint.postgresql.sh # buildkit
COPY healthcheck.postgresql.sh /usr/local/bin/healthcheck.postgresql.sh # buildkit
COPY /out/gosu /usr/local/bin/gosu # buildkit
RUN |2 POSTGRES_PG_SEARCH_VERSION=0.26.4 POSTGRES_VECTORCHORD_VERSION=1.1.1 /bin/bash -o pipefail -c chmod 0755 /usr/local/bin/gosu && gosu --version && gosu --version | grep -q 'go1.26.10' && gosu nobody true && chmod +x /docker-entrypoint-initdb.d/init_extensions.sh /usr/local/bin/entrypoint.postgresql.sh /usr/local/bin/healthcheck.postgresql.sh # buildkit

Labels

Key Value
maintainer openso
Details
Container
2026-11-01 14:39:55 +01:00
2
OCI / Docker
linux/amd64
258 MiB
Versions (2) View all
main 2026-11-01
latest 2026-11-01