Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update postgres #10376

Merged
merged 1 commit into from
Jun 16, 2021
Merged

Update postgres #10376

merged 1 commit into from
Jun 16, 2021

Conversation

yosifkit
Copy link
Member

Changes:

Changes:

- docker-library/postgres@0ecab40: Merge pull request docker-library/postgres#852 from infosiftr/jq-template
- docker-library/postgres@517c64f: Add initial jq-based templating engine
- docker-library/postgres@55001e0: Merge pull request docker-library/postgres#861 from J0WI/alpine-3.14
- docker-library/postgres@718c12a: Alpine 3.14
@github-actions
Copy link

Diff for 610ac9c:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index 92004d3..445369e 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1,52 +1,67 @@
 Maintainers: Tianon Gravi <admwiggin@gmail.com> (@tianon), Joseph Ferguson <yosifkit@gmail.com> (@yosifkit)
 GitRepo: https://github.com/docker-library/postgres.git
 
-Tags: 9.6.22, 9.6, 9
+Tags: 9.6.22, 9.6, 9, 9.6.22-stretch, 9.6-stretch, 9-stretch
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386
-GitCommit: 94c2885ff2030b25dc85eee1898e891d7d4b8bad
-Directory: 9.6
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
+Directory: 9.6/stretch
 
 Tags: 9.6.22-alpine, 9.6-alpine, 9-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 720ab505571bd3eddf0f4b04462cae5b9835f287
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
 Directory: 9.6/alpine
 
-Tags: 10.17, 10
+Tags: 9.6.22-buster, 9.6-buster, 9-buster
+Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
+Directory: 9.6/buster
+
+Tags: 10.17, 10, 10.17-stretch, 10-stretch
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386
-GitCommit: 376f87ce3b00273c5ea1f5446d6876227d5ddf07
-Directory: 10
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
+Directory: 10/stretch
 
 Tags: 10.17-alpine, 10-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: ea6eb8151f10fa6cb9be0f93c3e89f37bfd85fbf
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
 Directory: 10/alpine
 
-Tags: 11.12, 11
+Tags: 10.17-buster, 10-buster
+Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
+Directory: 10/buster
+
+Tags: 11.12, 11, 11.12-stretch, 11-stretch
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386
-GitCommit: a37f640216530c5e02c91fd37a9a5f230e8fc5b7
-Directory: 11
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
+Directory: 11/stretch
 
 Tags: 11.12-alpine, 11-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 34821014a8bbfe91c86f323dde1630ac32a6ffc9
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
 Directory: 11/alpine
 
-Tags: 12.7, 12
+Tags: 11.12-buster, 11-buster
+Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
+Directory: 11/buster
+
+Tags: 12.7, 12, 12.7-buster, 12-buster
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 553451e3c51f3baa2e793ce405369eb948b6e2d1
-Directory: 12
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
+Directory: 12/buster
 
 Tags: 12.7-alpine, 12-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 8536a3ba9d8a33bcab49d8cf42d42412c120aa14
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
 Directory: 12/alpine
 
-Tags: 13.3, 13, latest
+Tags: 13.3, 13, latest, 13.3-buster, 13-buster, buster
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: aed4d450b287b8fb3e834e21df8eeee37e0f8d28
-Directory: 13
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
+Directory: 13/buster
 
 Tags: 13.3-alpine, 13-alpine, alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 4a82bbde194ff4d32e90629b0a50b9398d374c12
+GitCommit: 517c64f87e6661366b415df3f2273c76cea428b0
 Directory: 13/alpine
diff --git a/_bashbrew-list b/_bashbrew-list
index fc33844..ddc95ac 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -1,24 +1,43 @@
 postgres:9
 postgres:9-alpine
+postgres:9-buster
+postgres:9-stretch
 postgres:9.6
 postgres:9.6-alpine
+postgres:9.6-buster
+postgres:9.6-stretch
 postgres:9.6.22
 postgres:9.6.22-alpine
+postgres:9.6.22-buster
+postgres:9.6.22-stretch
 postgres:10
 postgres:10-alpine
+postgres:10-buster
+postgres:10-stretch
 postgres:10.17
 postgres:10.17-alpine
+postgres:10.17-buster
+postgres:10.17-stretch
 postgres:11
 postgres:11-alpine
+postgres:11-buster
+postgres:11-stretch
 postgres:11.12
 postgres:11.12-alpine
+postgres:11.12-buster
+postgres:11.12-stretch
 postgres:12
 postgres:12-alpine
+postgres:12-buster
 postgres:12.7
 postgres:12.7-alpine
+postgres:12.7-buster
 postgres:13
 postgres:13-alpine
+postgres:13-buster
 postgres:13.3
 postgres:13.3-alpine
+postgres:13.3-buster
 postgres:alpine
+postgres:buster
 postgres:latest
diff --git a/postgres_10-alpine/Dockerfile b/postgres_10-alpine/Dockerfile
index ba63018..8131b4a 100644
--- a/postgres_10-alpine/Dockerfile
+++ b/postgres_10-alpine/Dockerfile
@@ -1,5 +1,10 @@
-# vim:set ft=dockerfile:
-FROM alpine:3.13
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
+FROM alpine:3.14
 
 # 70 is the standard uid/gid for "postgres" in Alpine
 # https://git.alpinelinux.org/aports/tree/main/postgresql/postgresql.pre-install?h=3.12-stable
@@ -59,6 +64,7 @@ RUN set -eux; \
 #		tcl-dev \
 		util-linux-dev \
 		zlib-dev \
+# https://www.postgresql.org/docs/10/static/release-10.html#id-1.11.6.9.5.13
 		icu-dev \
 	; \
 	\
@@ -134,7 +140,10 @@ RUN set -eux; \
 	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
-RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
+RUN set -eux; \
+	cp -v /usr/local/share/postgresql/postgresql.conf.sample /usr/local/share/postgresql/postgresql.conf.sample.orig; \
+	sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample; \
+	grep -F "listen_addresses = '*'" /usr/local/share/postgresql/postgresql.conf.sample
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
diff --git a/postgres_12/Dockerfile b/postgres_10-buster/Dockerfile
similarity index 95%
copy from postgres_12/Dockerfile
copy to postgres_10-buster/Dockerfile
index 1a4dd6f..795143f 100644
--- a/postgres_12/Dockerfile
+++ b/postgres_10-buster/Dockerfile
@@ -1,4 +1,9 @@
-# vim:set ft=dockerfile:
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
 FROM debian:buster-slim
 
 RUN set -ex; \
@@ -82,8 +87,10 @@ RUN set -ex; \
 	rm -rf "$GNUPGHOME"; \
 	apt-key list
 
-ENV PG_MAJOR 12
-ENV PG_VERSION 12.7-1.pgdg100+1
+ENV PG_MAJOR 10
+ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
+
+ENV PG_VERSION 10.17-1.pgdg100+1
 
 RUN set -ex; \
 	\
@@ -102,15 +109,6 @@ RUN set -ex; \
 # let's build binaries from their published source packages
 			echo "deb-src http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
 			\
-			case "$PG_MAJOR" in \
-				9.* | 10 ) ;; \
-				*) \
-# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
-# TODO remove this once we hit buster+
-					echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
-					;; \
-			esac; \
-			\
 			tempDir="$(mktemp -d)"; \
 			cd "$tempDir"; \
 			\
@@ -162,7 +160,9 @@ RUN set -ex; \
 	fi; \
 	\
 # some of the steps above generate a lot of "*.pyc" files (and setting "PYTHONDONTWRITEBYTECODE" beforehand doesn't propagate properly for some reason), so we clean them up manually (as long as they aren't owned by a package)
-	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
+	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; \
+	\
+	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
 RUN set -eux; \
@@ -174,7 +174,6 @@ RUN set -eux; \
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
-ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 ENV PGDATA /var/lib/postgresql/data
 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
 RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
diff --git a/postgres_10/docker-entrypoint.sh b/postgres_10-buster/docker-entrypoint.sh
similarity index 100%
copy from postgres_10/docker-entrypoint.sh
copy to postgres_10-buster/docker-entrypoint.sh
diff --git a/postgres_10/Dockerfile b/postgres_10-stretch/Dockerfile
similarity index 95%
rename from postgres_10/Dockerfile
rename to postgres_10-stretch/Dockerfile
index cab271e..2b7eb9c 100644
--- a/postgres_10/Dockerfile
+++ b/postgres_10-stretch/Dockerfile
@@ -1,4 +1,9 @@
-# vim:set ft=dockerfile:
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
 FROM debian:stretch-slim
 
 RUN set -ex; \
@@ -83,6 +88,8 @@ RUN set -ex; \
 	apt-key list
 
 ENV PG_MAJOR 10
+ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
+
 ENV PG_VERSION 10.17-1.pgdg90+1
 
 RUN set -ex; \
@@ -102,15 +109,6 @@ RUN set -ex; \
 # let's build binaries from their published source packages
 			echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
 			\
-			case "$PG_MAJOR" in \
-				9.* | 10 ) ;; \
-				*) \
-# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
-# TODO remove this once we hit buster+
-					echo 'deb http://deb.debian.org/debian stretch-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
-					;; \
-			esac; \
-			\
 			tempDir="$(mktemp -d)"; \
 			cd "$tempDir"; \
 			\
@@ -162,7 +160,9 @@ RUN set -ex; \
 	fi; \
 	\
 # some of the steps above generate a lot of "*.pyc" files (and setting "PYTHONDONTWRITEBYTECODE" beforehand doesn't propagate properly for some reason), so we clean them up manually (as long as they aren't owned by a package)
-	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
+	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; \
+	\
+	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
 RUN set -eux; \
@@ -174,7 +174,6 @@ RUN set -eux; \
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
-ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 ENV PGDATA /var/lib/postgresql/data
 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
 RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
diff --git a/postgres_11/docker-entrypoint.sh b/postgres_10-stretch/docker-entrypoint.sh
similarity index 100%
rename from postgres_11/docker-entrypoint.sh
rename to postgres_10-stretch/docker-entrypoint.sh
diff --git a/postgres_11-alpine/Dockerfile b/postgres_11-alpine/Dockerfile
index 934d9b9..acf676c 100644
--- a/postgres_11-alpine/Dockerfile
+++ b/postgres_11-alpine/Dockerfile
@@ -1,5 +1,10 @@
-# vim:set ft=dockerfile:
-FROM alpine:3.13
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
+FROM alpine:3.14
 
 # 70 is the standard uid/gid for "postgres" in Alpine
 # https://git.alpinelinux.org/aports/tree/main/postgresql/postgresql.pre-install?h=3.12-stable
@@ -46,7 +51,7 @@ RUN set -eux; \
 		libxml2-dev \
 		libxslt-dev \
 		linux-headers \
-		llvm10-dev clang g++ \
+		llvm11-dev clang g++ \
 		make \
 #		openldap-dev \
 		openssl-dev \
@@ -60,6 +65,7 @@ RUN set -eux; \
 #		tcl-dev \
 		util-linux-dev \
 		zlib-dev \
+# https://www.postgresql.org/docs/10/static/release-10.html#id-1.11.6.9.5.13
 		icu-dev \
 	; \
 	\
@@ -136,7 +142,10 @@ RUN set -eux; \
 	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
-RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
+RUN set -eux; \
+	cp -v /usr/local/share/postgresql/postgresql.conf.sample /usr/local/share/postgresql/postgresql.conf.sample.orig; \
+	sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample; \
+	grep -F "listen_addresses = '*'" /usr/local/share/postgresql/postgresql.conf.sample
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
@@ -146,7 +155,6 @@ RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PG
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh /usr/local/bin/
-RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
 ENTRYPOINT ["docker-entrypoint.sh"]
 
 # We set the default STOPSIGNAL to SIGINT, which corresponds to what PostgreSQL
diff --git a/postgres_12/Dockerfile b/postgres_11-buster/Dockerfile
similarity index 94%
copy from postgres_12/Dockerfile
copy to postgres_11-buster/Dockerfile
index 1a4dd6f..527456c 100644
--- a/postgres_12/Dockerfile
+++ b/postgres_11-buster/Dockerfile
@@ -1,4 +1,9 @@
-# vim:set ft=dockerfile:
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
 FROM debian:buster-slim
 
 RUN set -ex; \
@@ -82,8 +87,10 @@ RUN set -ex; \
 	rm -rf "$GNUPGHOME"; \
 	apt-key list
 
-ENV PG_MAJOR 12
-ENV PG_VERSION 12.7-1.pgdg100+1
+ENV PG_MAJOR 11
+ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
+
+ENV PG_VERSION 11.12-1.pgdg100+1
 
 RUN set -ex; \
 	\
@@ -102,15 +109,6 @@ RUN set -ex; \
 # let's build binaries from their published source packages
 			echo "deb-src http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
 			\
-			case "$PG_MAJOR" in \
-				9.* | 10 ) ;; \
-				*) \
-# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
-# TODO remove this once we hit buster+
-					echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
-					;; \
-			esac; \
-			\
 			tempDir="$(mktemp -d)"; \
 			cd "$tempDir"; \
 			\
@@ -162,7 +160,9 @@ RUN set -ex; \
 	fi; \
 	\
 # some of the steps above generate a lot of "*.pyc" files (and setting "PYTHONDONTWRITEBYTECODE" beforehand doesn't propagate properly for some reason), so we clean them up manually (as long as they aren't owned by a package)
-	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
+	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; \
+	\
+	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
 RUN set -eux; \
@@ -174,14 +174,12 @@ RUN set -eux; \
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
-ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 ENV PGDATA /var/lib/postgresql/data
 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
 RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh /usr/local/bin/
-RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
 ENTRYPOINT ["docker-entrypoint.sh"]
 
 # We set the default STOPSIGNAL to SIGINT, which corresponds to what PostgreSQL
diff --git a/postgres_12/docker-entrypoint.sh b/postgres_11-buster/docker-entrypoint.sh
similarity index 100%
rename from postgres_12/docker-entrypoint.sh
rename to postgres_11-buster/docker-entrypoint.sh
diff --git a/postgres_11/Dockerfile b/postgres_11-stretch/Dockerfile
similarity index 96%
rename from postgres_11/Dockerfile
rename to postgres_11-stretch/Dockerfile
index 340047f..a3f4610 100644
--- a/postgres_11/Dockerfile
+++ b/postgres_11-stretch/Dockerfile
@@ -1,4 +1,9 @@
-# vim:set ft=dockerfile:
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
 FROM debian:stretch-slim
 
 RUN set -ex; \
@@ -83,6 +88,8 @@ RUN set -ex; \
 	apt-key list
 
 ENV PG_MAJOR 11
+ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
+
 ENV PG_VERSION 11.12-1.pgdg90+1
 
 RUN set -ex; \
@@ -102,14 +109,8 @@ RUN set -ex; \
 # let's build binaries from their published source packages
 			echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
 			\
-			case "$PG_MAJOR" in \
-				9.* | 10 ) ;; \
-				*) \
 # https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
-# TODO remove this once we hit buster+
 			echo 'deb http://deb.debian.org/debian stretch-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
-					;; \
-			esac; \
 			\
 			tempDir="$(mktemp -d)"; \
 			cd "$tempDir"; \
@@ -162,7 +163,9 @@ RUN set -ex; \
 	fi; \
 	\
 # some of the steps above generate a lot of "*.pyc" files (and setting "PYTHONDONTWRITEBYTECODE" beforehand doesn't propagate properly for some reason), so we clean them up manually (as long as they aren't owned by a package)
-	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
+	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; \
+	\
+	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
 RUN set -eux; \
@@ -174,14 +177,12 @@ RUN set -eux; \
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
-ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 ENV PGDATA /var/lib/postgresql/data
 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
 RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh /usr/local/bin/
-RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
 ENTRYPOINT ["docker-entrypoint.sh"]
 
 # We set the default STOPSIGNAL to SIGINT, which corresponds to what PostgreSQL
diff --git a/postgres_latest/docker-entrypoint.sh b/postgres_11-stretch/docker-entrypoint.sh
similarity index 100%
rename from postgres_latest/docker-entrypoint.sh
rename to postgres_11-stretch/docker-entrypoint.sh
diff --git a/postgres_12-alpine/Dockerfile b/postgres_12-alpine/Dockerfile
index 86a10f3..21f6d42 100644
--- a/postgres_12-alpine/Dockerfile
+++ b/postgres_12-alpine/Dockerfile
@@ -1,5 +1,10 @@
-# vim:set ft=dockerfile:
-FROM alpine:3.13
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
+FROM alpine:3.14
 
 # 70 is the standard uid/gid for "postgres" in Alpine
 # https://git.alpinelinux.org/aports/tree/main/postgresql/postgresql.pre-install?h=3.12-stable
@@ -46,7 +51,7 @@ RUN set -eux; \
 		libxml2-dev \
 		libxslt-dev \
 		linux-headers \
-		llvm10-dev clang g++ \
+		llvm11-dev clang g++ \
 		make \
 #		openldap-dev \
 		openssl-dev \
@@ -60,6 +65,7 @@ RUN set -eux; \
 #		tcl-dev \
 		util-linux-dev \
 		zlib-dev \
+# https://www.postgresql.org/docs/10/static/release-10.html#id-1.11.6.9.5.13
 		icu-dev \
 	; \
 	\
@@ -136,7 +142,10 @@ RUN set -eux; \
 	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
-RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
+RUN set -eux; \
+	cp -v /usr/local/share/postgresql/postgresql.conf.sample /usr/local/share/postgresql/postgresql.conf.sample.orig; \
+	sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample; \
+	grep -F "listen_addresses = '*'" /usr/local/share/postgresql/postgresql.conf.sample
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
diff --git a/postgres_12/Dockerfile b/postgres_12-buster/Dockerfile
similarity index 95%
copy from postgres_12/Dockerfile
copy to postgres_12-buster/Dockerfile
index 1a4dd6f..6dafa8a 100644
--- a/postgres_12/Dockerfile
+++ b/postgres_12-buster/Dockerfile
@@ -1,4 +1,9 @@
-# vim:set ft=dockerfile:
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
 FROM debian:buster-slim
 
 RUN set -ex; \
@@ -83,6 +88,8 @@ RUN set -ex; \
 	apt-key list
 
 ENV PG_MAJOR 12
+ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
+
 ENV PG_VERSION 12.7-1.pgdg100+1
 
 RUN set -ex; \
@@ -102,15 +109,6 @@ RUN set -ex; \
 # let's build binaries from their published source packages
 			echo "deb-src http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
 			\
-			case "$PG_MAJOR" in \
-				9.* | 10 ) ;; \
-				*) \
-# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
-# TODO remove this once we hit buster+
-					echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
-					;; \
-			esac; \
-			\
 			tempDir="$(mktemp -d)"; \
 			cd "$tempDir"; \
 			\
@@ -162,7 +160,9 @@ RUN set -ex; \
 	fi; \
 	\
 # some of the steps above generate a lot of "*.pyc" files (and setting "PYTHONDONTWRITEBYTECODE" beforehand doesn't propagate properly for some reason), so we clean them up manually (as long as they aren't owned by a package)
-	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
+	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; \
+	\
+	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
 RUN set -eux; \
@@ -174,14 +174,12 @@ RUN set -eux; \
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
-ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 ENV PGDATA /var/lib/postgresql/data
 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
 RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh /usr/local/bin/
-RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
 ENTRYPOINT ["docker-entrypoint.sh"]
 
 # We set the default STOPSIGNAL to SIGINT, which corresponds to what PostgreSQL
diff --git a/postgres_10/docker-entrypoint.sh b/postgres_12-buster/docker-entrypoint.sh
similarity index 100%
copy from postgres_10/docker-entrypoint.sh
copy to postgres_12-buster/docker-entrypoint.sh
diff --git a/postgres_9-alpine/Dockerfile b/postgres_9-alpine/Dockerfile
index 9aaeb22..187747a 100644
--- a/postgres_9-alpine/Dockerfile
+++ b/postgres_9-alpine/Dockerfile
@@ -1,5 +1,10 @@
-# vim:set ft=dockerfile:
-FROM alpine:3.13
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
+FROM alpine:3.14
 
 # 70 is the standard uid/gid for "postgres" in Alpine
 # https://git.alpinelinux.org/aports/tree/main/postgresql/postgresql.pre-install?h=3.12-stable
@@ -132,7 +137,10 @@ RUN set -eux; \
 	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
-RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
+RUN set -eux; \
+	cp -v /usr/local/share/postgresql/postgresql.conf.sample /usr/local/share/postgresql/postgresql.conf.sample.orig; \
+	sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample; \
+	grep -F "listen_addresses = '*'" /usr/local/share/postgresql/postgresql.conf.sample
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
diff --git a/postgres_12/Dockerfile b/postgres_9-buster/Dockerfile
similarity index 95%
rename from postgres_12/Dockerfile
rename to postgres_9-buster/Dockerfile
index 1a4dd6f..5c7a42f 100644
--- a/postgres_12/Dockerfile
+++ b/postgres_9-buster/Dockerfile
@@ -1,4 +1,9 @@
-# vim:set ft=dockerfile:
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
 FROM debian:buster-slim
 
 RUN set -ex; \
@@ -82,8 +87,10 @@ RUN set -ex; \
 	rm -rf "$GNUPGHOME"; \
 	apt-key list
 
-ENV PG_MAJOR 12
-ENV PG_VERSION 12.7-1.pgdg100+1
+ENV PG_MAJOR 9.6
+ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
+
+ENV PG_VERSION 9.6.22-1.pgdg100+1
 
 RUN set -ex; \
 	\
@@ -102,15 +109,6 @@ RUN set -ex; \
 # let's build binaries from their published source packages
 			echo "deb-src http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
 			\
-			case "$PG_MAJOR" in \
-				9.* | 10 ) ;; \
-				*) \
-# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
-# TODO remove this once we hit buster+
-					echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
-					;; \
-			esac; \
-			\
 			tempDir="$(mktemp -d)"; \
 			cd "$tempDir"; \
 			\
@@ -151,6 +149,7 @@ RUN set -ex; \
 	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" \
+		"postgresql-contrib-$PG_MAJOR=$PG_VERSION" \
 	; \
 	\
 	rm -rf /var/lib/apt/lists/*; \
@@ -162,7 +161,9 @@ RUN set -ex; \
 	fi; \
 	\
 # some of the steps above generate a lot of "*.pyc" files (and setting "PYTHONDONTWRITEBYTECODE" beforehand doesn't propagate properly for some reason), so we clean them up manually (as long as they aren't owned by a package)
-	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
+	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; \
+	\
+	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
 RUN set -eux; \
@@ -174,7 +175,6 @@ RUN set -eux; \
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
-ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 ENV PGDATA /var/lib/postgresql/data
 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
 RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
diff --git a/postgres_9/docker-entrypoint.sh b/postgres_9-buster/docker-entrypoint.sh
similarity index 100%
copy from postgres_9/docker-entrypoint.sh
copy to postgres_9-buster/docker-entrypoint.sh
diff --git a/postgres_9/Dockerfile b/postgres_9-stretch/Dockerfile
similarity index 95%
rename from postgres_9/Dockerfile
rename to postgres_9-stretch/Dockerfile
index fa1ce0f..ddd03bb 100644
--- a/postgres_9/Dockerfile
+++ b/postgres_9-stretch/Dockerfile
@@ -1,4 +1,9 @@
-# vim:set ft=dockerfile:
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
 FROM debian:stretch-slim
 
 RUN set -ex; \
@@ -83,6 +88,8 @@ RUN set -ex; \
 	apt-key list
 
 ENV PG_MAJOR 9.6
+ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
+
 ENV PG_VERSION 9.6.22-1.pgdg90+1
 
 RUN set -ex; \
@@ -102,15 +109,6 @@ RUN set -ex; \
 # let's build binaries from their published source packages
 			echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
 			\
-			case "$PG_MAJOR" in \
-				9.* | 10 ) ;; \
-				*) \
-# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
-# TODO remove this once we hit buster+
-					echo 'deb http://deb.debian.org/debian stretch-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
-					;; \
-			esac; \
-			\
 			tempDir="$(mktemp -d)"; \
 			cd "$tempDir"; \
 			\
@@ -163,7 +161,9 @@ RUN set -ex; \
 	fi; \
 	\
 # some of the steps above generate a lot of "*.pyc" files (and setting "PYTHONDONTWRITEBYTECODE" beforehand doesn't propagate properly for some reason), so we clean them up manually (as long as they aren't owned by a package)
-	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
+	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; \
+	\
+	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
 RUN set -eux; \
@@ -175,7 +175,6 @@ RUN set -eux; \
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
-ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 ENV PGDATA /var/lib/postgresql/data
 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
 RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
diff --git a/postgres_9/docker-entrypoint.sh b/postgres_9-stretch/docker-entrypoint.sh
similarity index 100%
rename from postgres_9/docker-entrypoint.sh
rename to postgres_9-stretch/docker-entrypoint.sh
diff --git a/postgres_alpine/Dockerfile b/postgres_alpine/Dockerfile
index dfed309..2148b06 100644
--- a/postgres_alpine/Dockerfile
+++ b/postgres_alpine/Dockerfile
@@ -1,5 +1,10 @@
-# vim:set ft=dockerfile:
-FROM alpine:3.13
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
+FROM alpine:3.14
 
 # 70 is the standard uid/gid for "postgres" in Alpine
 # https://git.alpinelinux.org/aports/tree/main/postgresql/postgresql.pre-install?h=3.12-stable
@@ -46,7 +51,7 @@ RUN set -eux; \
 		libxml2-dev \
 		libxslt-dev \
 		linux-headers \
-		llvm10-dev clang g++ \
+		llvm11-dev clang g++ \
 		make \
 #		openldap-dev \
 		openssl-dev \
@@ -60,6 +65,7 @@ RUN set -eux; \
 #		tcl-dev \
 		util-linux-dev \
 		zlib-dev \
+# https://www.postgresql.org/docs/10/static/release-10.html#id-1.11.6.9.5.13
 		icu-dev \
 	; \
 	\
@@ -136,7 +142,10 @@ RUN set -eux; \
 	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
-RUN sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample
+RUN set -eux; \
+	cp -v /usr/local/share/postgresql/postgresql.conf.sample /usr/local/share/postgresql/postgresql.conf.sample.orig; \
+	sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/local/share/postgresql/postgresql.conf.sample; \
+	grep -F "listen_addresses = '*'" /usr/local/share/postgresql/postgresql.conf.sample
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
diff --git a/postgres_latest/Dockerfile b/postgres_buster/Dockerfile
similarity index 95%
rename from postgres_latest/Dockerfile
rename to postgres_buster/Dockerfile
index 46f1c2a..6ce45fa 100644
--- a/postgres_latest/Dockerfile
+++ b/postgres_buster/Dockerfile
@@ -1,4 +1,9 @@
-# vim:set ft=dockerfile:
+#
+# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
+#
+# PLEASE DO NOT EDIT IT DIRECTLY.
+#
+
 FROM debian:buster-slim
 
 RUN set -ex; \
@@ -83,6 +88,8 @@ RUN set -ex; \
 	apt-key list
 
 ENV PG_MAJOR 13
+ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
+
 ENV PG_VERSION 13.3-1.pgdg100+1
 
 RUN set -ex; \
@@ -102,15 +109,6 @@ RUN set -ex; \
 # let's build binaries from their published source packages
 			echo "deb-src http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
 			\
-			case "$PG_MAJOR" in \
-				9.* | 10 ) ;; \
-				*) \
-# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
-# TODO remove this once we hit buster+
-					echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
-					;; \
-			esac; \
-			\
 			tempDir="$(mktemp -d)"; \
 			cd "$tempDir"; \
 			\
@@ -164,7 +162,9 @@ RUN set -ex; \
 	fi; \
 	\
 # some of the steps above generate a lot of "*.pyc" files (and setting "PYTHONDONTWRITEBYTECODE" beforehand doesn't propagate properly for some reason), so we clean them up manually (as long as they aren't owned by a package)
-	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
+	find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; \
+	\
+	postgres --version
 
 # make the sample config easier to munge (and "correct by default")
 RUN set -eux; \
@@ -176,14 +176,12 @@ RUN set -eux; \
 
 RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
 
-ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 ENV PGDATA /var/lib/postgresql/data
 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
 RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh /usr/local/bin/
-RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat
 ENTRYPOINT ["docker-entrypoint.sh"]
 
 # We set the default STOPSIGNAL to SIGINT, which corresponds to what PostgreSQL
diff --git a/postgres_10/docker-entrypoint.sh b/postgres_buster/docker-entrypoint.sh
similarity index 100%
rename from postgres_10/docker-entrypoint.sh
rename to postgres_buster/docker-entrypoint.sh

@yosifkit
Copy link
Member Author

yosifkit commented Jun 16, 2021

For reference:

the bare 9, 10, and 11 aliases on version that are still on Stretch will stay on Stretch until it becomes EOL, at which point we no longer plan to update them (and they'll be dropped from the "supported" list completely, leaving only "10-buster" etc).

- docker-library/postgres#582 (comment)

So postgres:9, postgres:10. and postgres:11 will always be Debian Stretch (and will stop being updated when that version is end of life or Stretch is end of life).


Summary of docker-library/postgres#582: When upgrading from 9 (or 10 or 11) which is based on Debian Stretch to the same version but based on Debian Buster (9-buster), It should be enough to ensure you have a full backup (for safety) and then do a reindexdb --all in the new container.

Very rough untested steps

  1. make a postgres backup
  2. stop postgres:9 container
  3. start new postgres:9-buster container using same data directory
  4. run reindexdb --all in the new container (perhaps via docker exec)
  5. 🎉

@yosifkit yosifkit merged commit 7db3eb2 into docker-library:master Jun 16, 2021
@yosifkit yosifkit deleted the postgres branch June 16, 2021 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants