From a96a4216e03f6f81af1eefa8df9ed8d432a694e1 Mon Sep 17 00:00:00 2001 From: hashworks Date: Fri, 31 Jan 2025 21:02:46 +0100 Subject: [PATCH 1/5] Update to Debian Bookworm, drop deprecated apt-key usage --- Dockerfile | 18 +++++++++--------- Dockerfile.docs | 2 +- README.md | 6 ++++-- docs/citus/Dockerfile | 12 ++++++------ docs/citus/Dockerfile.app | 9 +++++---- docs/install.rst | 12 +++++++----- docs/tutorial/Dockerfile | 8 ++++---- docs/tutorial/Dockerfile.app | 9 +++++---- tests/tablespaces/Dockerfile | 2 +- 9 files changed, 42 insertions(+), 36 deletions(-) diff --git a/Dockerfile b/Dockerfile index 76b94a45d..b063f7052 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,16 @@ # -# Using --build-arg PGVERSION=14 we can build pg_auto_failover for any +# Using --build-arg PGVERSION=17 we can build pg_auto_failover for any # target version of Postgres. In the Makefile, we use that to our advantage # and tag test images such as pg_auto_failover_test:pg14. # -ARG PGVERSION=14 +ARG PGVERSION=17 # # Define a base image with all our build dependencies. # # This base image contains all our target Postgres versions. # -FROM debian:bullseye-slim AS base +FROM debian:bookworm-slim AS base ARG PGVERSION @@ -63,8 +63,8 @@ RUN apt-get update \ postgresql-common \ && rm -rf /var/lib/apt/lists/* -RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list +RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc +RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list # bypass initdb of a "main" cluster RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf @@ -84,7 +84,7 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers FROM base AS citus ARG PGVERSION -ARG CITUSTAG=v11.1.2 +ARG CITUSTAG=v13.0.0 ENV PG_CONFIG=/usr/lib/postgresql/${PGVERSION}/bin/pg_config @@ -136,7 +136,7 @@ ENV PATH /usr/lib/postgresql/${PGVERSION}/bin:/usr/local/sbin:/usr/local/bin:/us # # And finally our "run" images with the bare minimum for run-time. # -FROM debian:bullseye-slim AS run +FROM debian:bookworm-slim AS run ARG PGVERSION @@ -160,8 +160,8 @@ RUN apt-get update \ libpq-dev \ && rm -rf /var/lib/apt/lists/* -RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list +RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc +RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list # bypass initdb of a "main" cluster RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf diff --git a/Dockerfile.docs b/Dockerfile.docs index 4932a0ad5..13f7d5882 100644 --- a/Dockerfile.docs +++ b/Dockerfile.docs @@ -1,4 +1,4 @@ -FROM debian:bullseye-slim +FROM debian:bookworm-slim RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ diff --git a/README.md b/README.md index 96acfdb4b..94b73ae36 100644 --- a/README.md +++ b/README.md @@ -84,8 +84,10 @@ To avoid debian creating a default Postgres data directory and service, follow these steps before installing the previous packages. ```bash -$ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -$ echo "deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list +$ apt install curl ca-certificates +$ install -d /usr/share/postgresql-common/pgdg +$ curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail 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 $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list # bypass initdb of a "main" cluster $ echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf diff --git a/docs/citus/Dockerfile b/docs/citus/Dockerfile index d7d168218..3b0b1576e 100644 --- a/docs/citus/Dockerfile +++ b/docs/citus/Dockerfile @@ -1,7 +1,7 @@ -FROM debian:bullseye-slim +FROM debian:bookworm-slim -ARG PGVERSION=14 -ARG CITUS=postgresql-14-citus-11.1 +ARG PGVERSION=17 +ARG CITUS=postgresql-17-citus-13.0 RUN apt-get update \ && apt-get install -y --no-install-recommends \ @@ -19,9 +19,9 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* # we use apt.postgresql.org -RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list -RUN echo "deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list +RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc +RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list +RUN echo "deb-src [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list # bypass initdb of a "main" cluster RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf diff --git a/docs/citus/Dockerfile.app b/docs/citus/Dockerfile.app index d978fbd0d..0aecc2c52 100644 --- a/docs/citus/Dockerfile.app +++ b/docs/citus/Dockerfile.app @@ -1,4 +1,4 @@ -FROM debian:bullseye-slim +FROM debian:bookworm-slim ARG PGVERSION=14 @@ -17,9 +17,10 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* # we use apt.postgresql.org -RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list -RUN echo "deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list +RUN install -d /usr/share/postgresql-common/pgdg +RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc +RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list +RUN echo "deb-src [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ diff --git a/docs/install.rst b/docs/install.rst index c0db40bac..6de241050 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -41,8 +41,10 @@ debian package, follow those steps: :: - $ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - - $ echo "deb http://apt.postgresql.org/pub/repos/apt bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list + $ apt install curl ca-certificates + $ install -d /usr/share/postgresql-common/pgdg + $ curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail 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 $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list # bypass initdb of a "main" cluster $ echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf @@ -116,12 +118,12 @@ install`. For this to work please consider adding both the binary and the source repositories to your debian distribution by using the following apt sources, -as an example targetting the debian bullseye distribution: +as an example targetting the debian bookworm distribution: :: - deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main - deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main + deb https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main + deb-src https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main Then we can install the build dependencies for Postgres, knowing that pg_auto_failover uses the same build dependencies: diff --git a/docs/tutorial/Dockerfile b/docs/tutorial/Dockerfile index 3ce4536f9..324f0c303 100644 --- a/docs/tutorial/Dockerfile +++ b/docs/tutorial/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:bullseye-slim +FROM debian:bookworm-slim ARG PGVERSION=14 ARG CITUS=postgresql-14-citus-11.1 @@ -19,9 +19,9 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* # we use apt.postgresql.org -RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list -RUN echo "deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list +RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc +RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list +RUN echo "deb-src [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list # bypass initdb of a "main" cluster RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf diff --git a/docs/tutorial/Dockerfile.app b/docs/tutorial/Dockerfile.app index d978fbd0d..0aecc2c52 100644 --- a/docs/tutorial/Dockerfile.app +++ b/docs/tutorial/Dockerfile.app @@ -1,4 +1,4 @@ -FROM debian:bullseye-slim +FROM debian:bookworm-slim ARG PGVERSION=14 @@ -17,9 +17,10 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* # we use apt.postgresql.org -RUN curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - -RUN echo "deb http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list -RUN echo "deb-src http://apt.postgresql.org/pub/repos/apt bullseye-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list +RUN install -d /usr/share/postgresql-common/pgdg +RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc +RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list +RUN echo "deb-src [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.src.list RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ diff --git a/tests/tablespaces/Dockerfile b/tests/tablespaces/Dockerfile index fc1cbbb5f..82b01a768 100644 --- a/tests/tablespaces/Dockerfile +++ b/tests/tablespaces/Dockerfile @@ -1,6 +1,6 @@ ARG PGVERSION=14 -FROM pg_auto_failover_test:pg${PGVERSION} as test +FROM pg_auto_failover_test:pg${PGVERSION} AS test USER root RUN mkdir -p /extra_volumes/extended_a && chown -R docker /extra_volumes/extended_a From 736e228d586d9c49aaa0c6d86832e67d362a29f9 Mon Sep 17 00:00:00 2001 From: hashworks Date: Mon, 3 Feb 2025 14:11:56 +0100 Subject: [PATCH 2/5] Update tutorial Dockerfile to latest PostgreSQL and Citus Fixes #1029. --- docs/tutorial/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/tutorial/Dockerfile b/docs/tutorial/Dockerfile index 324f0c303..eae72c2e8 100644 --- a/docs/tutorial/Dockerfile +++ b/docs/tutorial/Dockerfile @@ -1,7 +1,7 @@ FROM debian:bookworm-slim -ARG PGVERSION=14 -ARG CITUS=postgresql-14-citus-11.1 +ARG PGVERSION=17 +ARG CITUS=postgresql-17-citus-13.0 RUN apt-get update \ && apt-get install -y --no-install-recommends \ From 66649731c7e4a54634a496519ceee9e027f76da9 Mon Sep 17 00:00:00 2001 From: hashworks Date: Mon, 3 Feb 2025 15:35:29 +0100 Subject: [PATCH 3/5] Use latest PostgreSQL by default --- docs/citus/Dockerfile.app | 2 +- docs/tutorial/Dockerfile.app | 2 +- src/bin/pg_autoctl/cli_do_tmux_compose.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/citus/Dockerfile.app b/docs/citus/Dockerfile.app index 0aecc2c52..651c2251a 100644 --- a/docs/citus/Dockerfile.app +++ b/docs/citus/Dockerfile.app @@ -1,6 +1,6 @@ FROM debian:bookworm-slim -ARG PGVERSION=14 +ARG PGVERSION=17 RUN apt-get update \ && apt-get install -y --no-install-recommends \ diff --git a/docs/tutorial/Dockerfile.app b/docs/tutorial/Dockerfile.app index 0aecc2c52..651c2251a 100644 --- a/docs/tutorial/Dockerfile.app +++ b/docs/tutorial/Dockerfile.app @@ -1,6 +1,6 @@ FROM debian:bookworm-slim -ARG PGVERSION=14 +ARG PGVERSION=17 RUN apt-get update \ && apt-get install -y --no-install-recommends \ diff --git a/src/bin/pg_autoctl/cli_do_tmux_compose.c b/src/bin/pg_autoctl/cli_do_tmux_compose.c index 5d916ff15..203783c58 100644 --- a/src/bin/pg_autoctl/cli_do_tmux_compose.c +++ b/src/bin/pg_autoctl/cli_do_tmux_compose.c @@ -364,13 +364,13 @@ tmux_compose_docker_build(TmuxOptions *options) if (!get_env_copy("PGVERSION", pgversion, sizeof(pgversion))) { /* errors have already been logged */ - log_warn("Using PGVERSION=14"); - strlcpy(pgversion, "14", sizeof(pgversion)); + log_warn("Using PGVERSION=17"); + strlcpy(pgversion, "17", sizeof(pgversion)); } } else { - strlcpy(pgversion, "14", sizeof(pgversion)); + strlcpy(pgversion, "17", sizeof(pgversion)); } /* prepare our --build-arg PGVERSION=XX */ From bf834295460cead4be64b499e4609b6f1c5b953c Mon Sep 17 00:00:00 2001 From: hashworks Date: Tue, 4 Feb 2025 14:49:14 +0100 Subject: [PATCH 4/5] Overwrite PEP 668 until pip is replaced --- Dockerfile | 2 +- Dockerfile.docs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b063f7052..9a5708ce5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -74,7 +74,7 @@ RUN apt-get update \ postgresql-${PGVERSION} \ && rm -rf /var/lib/apt/lists/* -RUN pip3 install pyroute2>=0.5.17 +RUN pip3 install --break-system-packages pyroute2>=0.5.17 RUN adduser --disabled-password --gecos '' docker RUN adduser docker sudo diff --git a/Dockerfile.docs b/Dockerfile.docs index 13f7d5882..1bbd3bfa1 100644 --- a/Dockerfile.docs +++ b/Dockerfile.docs @@ -18,7 +18,7 @@ RUN apt-get update \ poppler-utils \ && rm -rf /var/lib/apt/lists/* -RUN pip3 install sphinx_rtd_theme +RUN pip3 install --break-system-packages sphinx_rtd_theme WORKDIR /usr/src/pg_auto_failover From a793c5eeaefee154bf431a31154b7656cf1d285b Mon Sep 17 00:00:00 2001 From: hashworks Date: Sun, 9 Feb 2025 18:05:31 +0100 Subject: [PATCH 5/5] Add postgres apt sources before any substantial apt-get install calls This avoids conflicts with packages both in the postgres and in the main debian package sources. I.e. installing libpq before libpq-dev from the postgres sources can lead to broken links for `libpq.so.5`. --- Dockerfile | 98 +++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9a5708ce5..b4f099243 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,21 +15,31 @@ FROM debian:bookworm-slim AS base ARG PGVERSION RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - build-essential \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ ca-certificates \ - curl \ - gnupg \ - git \ - gawk \ - flex \ - bison \ + curl \ + postgresql-common + +RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc +RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list + +# bypass initdb of a "main" cluster +RUN echo 'create_main_cluster = false' >> /etc/postgresql-common/createcluster.conf + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + build-essential \ + gnupg \ + git \ + gawk \ + flex \ + bison \ iproute2 \ - libcurl4-gnutls-dev \ - libicu-dev \ - libncurses-dev \ - libxml2-dev \ - zlib1g-dev \ + libcurl4-gnutls-dev \ + libicu-dev \ + libncurses-dev \ + libxml2-dev \ + zlib1g-dev \ libedit-dev \ libkrb5-dev \ liblz4-dev \ @@ -41,16 +51,16 @@ RUN apt-get update \ libxslt1-dev \ libzstd-dev \ uuid-dev \ - make \ - autoconf \ + make \ + autoconf \ openssl \ pipenv \ python3-nose \ python3 \ - python3-setuptools \ - python3-psycopg2 \ + python3-setuptools \ + python3-psycopg2 \ python3-pip \ - sudo \ + sudo \ tmux \ watch \ lsof \ @@ -58,21 +68,11 @@ RUN apt-get update \ psmisc \ htop \ less \ - mg \ + mg \ valgrind \ - postgresql-common \ - && rm -rf /var/lib/apt/lists/* - -RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc -RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list - -# bypass initdb of a "main" cluster -RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf -RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - postgresql-server-dev-${PGVERSION} \ - postgresql-${PGVERSION} \ - && rm -rf /var/lib/apt/lists/* + postgresql-server-dev-${PGVERSION} \ + postgresql-${PGVERSION} \ + && rm -rf /var/lib/apt/lists/* RUN pip3 install --break-system-packages pyroute2>=0.5.17 @@ -141,33 +141,33 @@ FROM debian:bookworm-slim AS run ARG PGVERSION RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ ca-certificates \ - curl \ - gnupg \ + curl \ + postgresql-common + +RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc +RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list + +# bypass initdb of a "main" cluster +RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf + +RUN apt-get update \ + && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + gnupg \ make \ sudo \ tmux \ - watch \ + watch \ libncurses6 \ lsof \ psutils \ dnsutils \ bind9-host \ - libcurl4-gnutls-dev \ + libcurl4-gnutls-dev \ libzstd-dev \ - postgresql-common \ libpq-dev \ - && rm -rf /var/lib/apt/lists/* - -RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc -RUN echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt bookworm-pgdg main ${PGVERSION}" > /etc/apt/sources.list.d/pgdg.list - -# bypass initdb of a "main" cluster -RUN echo 'create_main_cluster = false' | sudo tee -a /etc/postgresql-common/createcluster.conf -RUN apt-get update\ - && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends postgresql-${PGVERSION} \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* RUN adduser --disabled-password --gecos '' --home /var/lib/postgres docker RUN adduser docker sudo @@ -189,7 +189,7 @@ COPY --from=build /usr/lib/postgresql/${PGVERSION}/bin/pg_autoctl /usr/local/bin # pg_autoctl has the necessary set of privileges. # RUN mkdir -p /var/lib/postgres \ - && chown -R docker /var/lib/postgres + && chown -R docker /var/lib/postgres USER docker ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/postgresql/${PGVERSION}/bin