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

[security] Update postgres #17330

Merged
merged 1 commit into from
Aug 8, 2024

Conversation

tianon
Copy link
Member

@tianon tianon commented Aug 8, 2024

Changes:

Changes:

- docker-library/postgres@805329e: Update 17 to 17beta3, bookworm 17~beta3-1.pgdg120+1, bullseye 17~beta3-1.pgdg110+1
- docker-library/postgres@3a94d96: Update 16 to 16.4, bookworm 16.4-1.pgdg120+1, bullseye 16.4-1.pgdg110+1
- docker-library/postgres@8cce578: Update 15 to 15.8, bookworm 15.8-1.pgdg120+1, bullseye 15.8-1.pgdg110+1
- docker-library/postgres@e324d93: Update 14 to 14.13, bookworm 14.13-1.pgdg120+1, bullseye 14.13-1.pgdg110+1
- docker-library/postgres@ce54cce: Update 13 to 13.16, bookworm 13.16-1.pgdg120+1, bullseye 13.16-1.pgdg110+1
- docker-library/postgres@62f99df: Update 12 to 12.20, bookworm 12.20-1.pgdg120+1, bullseye 12.20-1.pgdg110+1
- docker-library/postgres@66da384: Merge pull request docker-library/postgres#1258 from infosiftr/install
- docker-library/postgres@a09f1c4: Use `install` instead of `mkdir && chown && chmod`
@tianon tianon requested a review from a team as a code owner August 8, 2024 18:03
Copy link

github-actions bot commented Aug 8, 2024

Diff for 66c8524:
diff --git a/_bashbrew-cat b/_bashbrew-cat
index e3a1084..45541b2 100644
--- a/_bashbrew-cat
+++ b/_bashbrew-cat
@@ -1,122 +1,122 @@
 Maintainers: Tianon Gravi <admwiggin@gmail.com> (@tianon), Joseph Ferguson <yosifkit@gmail.com> (@yosifkit)
 GitRepo: https://github.com/docker-library/postgres.git
 
-Tags: 12.19, 12, 12.19-bookworm, 12-bookworm
+Tags: 12.20, 12, 12.20-bookworm, 12-bookworm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: ccf4f2289a1e59ddf74a5d1e6eb7693b7f464b54
+GitCommit: 62f99df90060f4105ebe9a6bd88611370f52aa16
 Directory: 12/bookworm
 
-Tags: 12.19-alpine3.19, 12-alpine3.19
+Tags: 12.20-alpine3.19, 12-alpine3.19
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: 62f99df90060f4105ebe9a6bd88611370f52aa16
 Directory: 12/alpine3.19
 
-Tags: 12.19-alpine3.20, 12-alpine3.20, 12.19-alpine, 12-alpine
+Tags: 12.20-alpine3.20, 12-alpine3.20, 12.20-alpine, 12-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: 62f99df90060f4105ebe9a6bd88611370f52aa16
 Directory: 12/alpine3.20
 
-Tags: 12.19-bullseye, 12-bullseye
+Tags: 12.20-bullseye, 12-bullseye
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: ccf4f2289a1e59ddf74a5d1e6eb7693b7f464b54
+GitCommit: 62f99df90060f4105ebe9a6bd88611370f52aa16
 Directory: 12/bullseye
 
-Tags: 13.15, 13, 13.15-bookworm, 13-bookworm
+Tags: 13.16, 13, 13.16-bookworm, 13-bookworm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: f3ab8c6db63e2986453e0a4fae2c5f372dd4f05e
+GitCommit: ce54cce510ed5da4ed9e1e66ddeb6e3300786813
 Directory: 13/bookworm
 
-Tags: 13.15-alpine3.19, 13-alpine3.19
+Tags: 13.16-alpine3.19, 13-alpine3.19
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: ce54cce510ed5da4ed9e1e66ddeb6e3300786813
 Directory: 13/alpine3.19
 
-Tags: 13.15-alpine3.20, 13-alpine3.20, 13.15-alpine, 13-alpine
+Tags: 13.16-alpine3.20, 13-alpine3.20, 13.16-alpine, 13-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: ce54cce510ed5da4ed9e1e66ddeb6e3300786813
 Directory: 13/alpine3.20
 
-Tags: 13.15-bullseye, 13-bullseye
+Tags: 13.16-bullseye, 13-bullseye
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: f3ab8c6db63e2986453e0a4fae2c5f372dd4f05e
+GitCommit: ce54cce510ed5da4ed9e1e66ddeb6e3300786813
 Directory: 13/bullseye
 
-Tags: 14.12, 14, 14.12-bookworm, 14-bookworm
+Tags: 14.13, 14, 14.13-bookworm, 14-bookworm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 662dbe5225f4d404364bdcf5e49dd5d88357ed31
+GitCommit: e324d93eba7160270512436fd5e9464f91cfbcb9
 Directory: 14/bookworm
 
-Tags: 14.12-alpine3.19, 14-alpine3.19
+Tags: 14.13-alpine3.19, 14-alpine3.19
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: e324d93eba7160270512436fd5e9464f91cfbcb9
 Directory: 14/alpine3.19
 
-Tags: 14.12-alpine3.20, 14-alpine3.20, 14.12-alpine, 14-alpine
+Tags: 14.13-alpine3.20, 14-alpine3.20, 14.13-alpine, 14-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: e324d93eba7160270512436fd5e9464f91cfbcb9
 Directory: 14/alpine3.20
 
-Tags: 14.12-bullseye, 14-bullseye
+Tags: 14.13-bullseye, 14-bullseye
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 662dbe5225f4d404364bdcf5e49dd5d88357ed31
+GitCommit: e324d93eba7160270512436fd5e9464f91cfbcb9
 Directory: 14/bullseye
 
-Tags: 15.7, 15, 15.7-bookworm, 15-bookworm
+Tags: 15.8, 15, 15.8-bookworm, 15-bookworm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 8a0b96710d917d1c3b32a5fe5b66687ad83827da
+GitCommit: 8cce578a4361ed18a29f53fed24e4554f673a3a4
 Directory: 15/bookworm
 
-Tags: 15.7-alpine3.19, 15-alpine3.19
+Tags: 15.8-alpine3.19, 15-alpine3.19
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: 8cce578a4361ed18a29f53fed24e4554f673a3a4
 Directory: 15/alpine3.19
 
-Tags: 15.7-alpine3.20, 15-alpine3.20, 15.7-alpine, 15-alpine
+Tags: 15.8-alpine3.20, 15-alpine3.20, 15.8-alpine, 15-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: 8cce578a4361ed18a29f53fed24e4554f673a3a4
 Directory: 15/alpine3.20
 
-Tags: 15.7-bullseye, 15-bullseye
+Tags: 15.8-bullseye, 15-bullseye
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 8a0b96710d917d1c3b32a5fe5b66687ad83827da
+GitCommit: 8cce578a4361ed18a29f53fed24e4554f673a3a4
 Directory: 15/bullseye
 
-Tags: 16.3, 16, latest, 16.3-bookworm, 16-bookworm, bookworm
+Tags: 16.4, 16, latest, 16.4-bookworm, 16-bookworm, bookworm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: d08757ccb56ee047efd76c41dbc148e2e2c4f68f
+GitCommit: 3a94d965ecbe08f4b1b255d3ed9ccae671a7a984
 Directory: 16/bookworm
 
-Tags: 16.3-alpine3.19, 16-alpine3.19, alpine3.19
+Tags: 16.4-alpine3.19, 16-alpine3.19, alpine3.19
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: 3a94d965ecbe08f4b1b255d3ed9ccae671a7a984
 Directory: 16/alpine3.19
 
-Tags: 16.3-alpine3.20, 16-alpine3.20, alpine3.20, 16.3-alpine, 16-alpine, alpine
+Tags: 16.4-alpine3.20, 16-alpine3.20, alpine3.20, 16.4-alpine, 16-alpine, alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 3e9b4eaaebf00d7a8ece67f02e2d6546402f4de7
+GitCommit: 3a94d965ecbe08f4b1b255d3ed9ccae671a7a984
 Directory: 16/alpine3.20
 
-Tags: 16.3-bullseye, 16-bullseye, bullseye
+Tags: 16.4-bullseye, 16-bullseye, bullseye
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: d08757ccb56ee047efd76c41dbc148e2e2c4f68f
+GitCommit: 3a94d965ecbe08f4b1b255d3ed9ccae671a7a984
 Directory: 16/bullseye
 
-Tags: 17beta2, 17beta2-bookworm
+Tags: 17beta3, 17beta3-bookworm
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 9bf5a6d620a90158d8192ee0dba05acc4464d002
+GitCommit: 805329e7a64fad212a5d4b07abd11238a9beab75
 Directory: 17/bookworm
 
-Tags: 17beta2-alpine3.19
+Tags: 17beta3-alpine3.19
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, s390x
-GitCommit: 9bf5a6d620a90158d8192ee0dba05acc4464d002
+GitCommit: 805329e7a64fad212a5d4b07abd11238a9beab75
 Directory: 17/alpine3.19
 
-Tags: 17beta2-alpine3.20, 17beta2-alpine
+Tags: 17beta3-alpine3.20, 17beta3-alpine
 Architectures: amd64, arm32v6, arm32v7, arm64v8, i386, ppc64le, riscv64, s390x
-GitCommit: 9bf5a6d620a90158d8192ee0dba05acc4464d002
+GitCommit: 805329e7a64fad212a5d4b07abd11238a9beab75
 Directory: 17/alpine3.20
 
-Tags: 17beta2-bullseye
+Tags: 17beta3-bullseye
 Architectures: amd64, arm32v5, arm32v7, arm64v8, i386, mips64le, ppc64le, s390x
-GitCommit: 9bf5a6d620a90158d8192ee0dba05acc4464d002
+GitCommit: 805329e7a64fad212a5d4b07abd11238a9beab75
 Directory: 17/bullseye
diff --git a/_bashbrew-list b/_bashbrew-list
index 6c41385..11996b8 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -4,66 +4,66 @@ postgres:12-alpine3.19
 postgres:12-alpine3.20
 postgres:12-bookworm
 postgres:12-bullseye
-postgres:12.19
-postgres:12.19-alpine
-postgres:12.19-alpine3.19
-postgres:12.19-alpine3.20
-postgres:12.19-bookworm
-postgres:12.19-bullseye
+postgres:12.20
+postgres:12.20-alpine
+postgres:12.20-alpine3.19
+postgres:12.20-alpine3.20
+postgres:12.20-bookworm
+postgres:12.20-bullseye
 postgres:13
 postgres:13-alpine
 postgres:13-alpine3.19
 postgres:13-alpine3.20
 postgres:13-bookworm
 postgres:13-bullseye
-postgres:13.15
-postgres:13.15-alpine
-postgres:13.15-alpine3.19
-postgres:13.15-alpine3.20
-postgres:13.15-bookworm
-postgres:13.15-bullseye
+postgres:13.16
+postgres:13.16-alpine
+postgres:13.16-alpine3.19
+postgres:13.16-alpine3.20
+postgres:13.16-bookworm
+postgres:13.16-bullseye
 postgres:14
 postgres:14-alpine
 postgres:14-alpine3.19
 postgres:14-alpine3.20
 postgres:14-bookworm
 postgres:14-bullseye
-postgres:14.12
-postgres:14.12-alpine
-postgres:14.12-alpine3.19
-postgres:14.12-alpine3.20
-postgres:14.12-bookworm
-postgres:14.12-bullseye
+postgres:14.13
+postgres:14.13-alpine
+postgres:14.13-alpine3.19
+postgres:14.13-alpine3.20
+postgres:14.13-bookworm
+postgres:14.13-bullseye
 postgres:15
 postgres:15-alpine
 postgres:15-alpine3.19
 postgres:15-alpine3.20
 postgres:15-bookworm
 postgres:15-bullseye
-postgres:15.7
-postgres:15.7-alpine
-postgres:15.7-alpine3.19
-postgres:15.7-alpine3.20
-postgres:15.7-bookworm
-postgres:15.7-bullseye
+postgres:15.8
+postgres:15.8-alpine
+postgres:15.8-alpine3.19
+postgres:15.8-alpine3.20
+postgres:15.8-bookworm
+postgres:15.8-bullseye
 postgres:16
 postgres:16-alpine
 postgres:16-alpine3.19
 postgres:16-alpine3.20
 postgres:16-bookworm
 postgres:16-bullseye
-postgres:16.3
-postgres:16.3-alpine
-postgres:16.3-alpine3.19
-postgres:16.3-alpine3.20
-postgres:16.3-bookworm
-postgres:16.3-bullseye
-postgres:17beta2
-postgres:17beta2-alpine
-postgres:17beta2-alpine3.19
-postgres:17beta2-alpine3.20
-postgres:17beta2-bookworm
-postgres:17beta2-bullseye
+postgres:16.4
+postgres:16.4-alpine
+postgres:16.4-alpine3.19
+postgres:16.4-alpine3.20
+postgres:16.4-bookworm
+postgres:16.4-bullseye
+postgres:17beta3
+postgres:17beta3-alpine
+postgres:17beta3-alpine3.19
+postgres:17beta3-alpine3.20
+postgres:17beta3-bookworm
+postgres:17beta3-bullseye
 postgres:alpine
 postgres:alpine3.19
 postgres:alpine3.20
diff --git a/_bashbrew-list-build-order b/_bashbrew-list-build-order
index 54a7b45..8a01655 100644
--- a/_bashbrew-list-build-order
+++ b/_bashbrew-list-build-order
@@ -14,10 +14,10 @@ postgres:15-alpine
 postgres:15-alpine3.19
 postgres:15-bookworm
 postgres:15-bullseye
-postgres:17beta2-alpine
-postgres:17beta2-alpine3.19
-postgres:17beta2-bookworm
-postgres:17beta2-bullseye
+postgres:17beta3-alpine
+postgres:17beta3-alpine3.19
+postgres:17beta3-bookworm
+postgres:17beta3-bullseye
 postgres:alpine
 postgres:alpine3.19
 postgres:bookworm
diff --git a/postgres_12-alpine/Dockerfile b/postgres_12-alpine/Dockerfile
index f1caf31..2c1db6c 100644
--- a/postgres_12-alpine/Dockerfile
+++ b/postgres_12-alpine/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.20
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 12
-ENV PG_VERSION 12.19
-ENV PG_SHA256 617e3de52c22e822f4f57d01d5b2240503e198a9eccaf598a851109bd18e6fbb
+ENV PG_VERSION 12.20
+ENV PG_SHA256 2d543af3009fec7fd5af35f7a70c95085d3eef6b508e517aa9493e99b15e9ea9
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -188,11 +189,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_12-alpine3.19/Dockerfile b/postgres_12-alpine3.19/Dockerfile
index eb46f0f..e3f5683 100644
--- a/postgres_12-alpine3.19/Dockerfile
+++ b/postgres_12-alpine3.19/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.19
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 12
-ENV PG_VERSION 12.19
-ENV PG_SHA256 617e3de52c22e822f4f57d01d5b2240503e198a9eccaf598a851109bd18e6fbb
+ENV PG_VERSION 12.20
+ENV PG_SHA256 2d543af3009fec7fd5af35f7a70c95085d3eef6b508e517aa9493e99b15e9ea9
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -188,11 +189,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_12-bookworm/Dockerfile b/postgres_12-bookworm/Dockerfile
index e697613..d80c0a4 100644
--- a/postgres_12-bookworm/Dockerfile
+++ b/postgres_12-bookworm/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 12
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 12.19-1.pgdg120+1
+ENV PG_VERSION 12.20-1.pgdg120+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_12-bullseye/Dockerfile b/postgres_12-bullseye/Dockerfile
index da4e8e2..f11f9db 100644
--- a/postgres_12-bullseye/Dockerfile
+++ b/postgres_12-bullseye/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 12
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 12.19-1.pgdg110+1
+ENV PG_VERSION 12.20-1.pgdg110+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_13-alpine/Dockerfile b/postgres_13-alpine/Dockerfile
index 567da31..d365154 100644
--- a/postgres_13-alpine/Dockerfile
+++ b/postgres_13-alpine/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.20
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 13
-ENV PG_VERSION 13.15
-ENV PG_SHA256 42edd415446d33b8c242be76d1ad057531b2264b2e86939339b7075c6e4ec925
+ENV PG_VERSION 13.16
+ENV PG_SHA256 c9cbbb6129f02328204828066bb3785c00a85c8ca8fd329c2a8a53c1f5cd8865
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -188,11 +189,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_13-alpine3.19/Dockerfile b/postgres_13-alpine3.19/Dockerfile
index 39a2352..eb4350a 100644
--- a/postgres_13-alpine3.19/Dockerfile
+++ b/postgres_13-alpine3.19/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.19
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 13
-ENV PG_VERSION 13.15
-ENV PG_SHA256 42edd415446d33b8c242be76d1ad057531b2264b2e86939339b7075c6e4ec925
+ENV PG_VERSION 13.16
+ENV PG_SHA256 c9cbbb6129f02328204828066bb3785c00a85c8ca8fd329c2a8a53c1f5cd8865
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -188,11 +189,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_13-bookworm/Dockerfile b/postgres_13-bookworm/Dockerfile
index 8b00f0e..8c9451e 100644
--- a/postgres_13-bookworm/Dockerfile
+++ b/postgres_13-bookworm/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 13
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 13.15-1.pgdg120+1
+ENV PG_VERSION 13.16-1.pgdg120+1
 
 RUN set -ex; \
 	\
@@ -183,11 +182,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_13-bullseye/Dockerfile b/postgres_13-bullseye/Dockerfile
index b421068..c8770da 100644
--- a/postgres_13-bullseye/Dockerfile
+++ b/postgres_13-bullseye/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 13
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 13.15-1.pgdg110+1
+ENV PG_VERSION 13.16-1.pgdg110+1
 
 RUN set -ex; \
 	\
@@ -183,11 +182,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_14-alpine/Dockerfile b/postgres_14-alpine/Dockerfile
index dc839d7..4b89e0d 100644
--- a/postgres_14-alpine/Dockerfile
+++ b/postgres_14-alpine/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.20
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 14
-ENV PG_VERSION 14.12
-ENV PG_SHA256 6118d08f9ddcc1bd83cf2b7cc74d3b583bdcec2f37e6245a8ac003b8faa80923
+ENV PG_VERSION 14.13
+ENV PG_SHA256 59aa3c4b495ab26a9ec69f3ad0a0228c51f0fe6facf3634dfad4d1197d613a56
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -191,11 +192,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_14-alpine3.19/Dockerfile b/postgres_14-alpine3.19/Dockerfile
index 461318e..533e23e 100644
--- a/postgres_14-alpine3.19/Dockerfile
+++ b/postgres_14-alpine3.19/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.19
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 14
-ENV PG_VERSION 14.12
-ENV PG_SHA256 6118d08f9ddcc1bd83cf2b7cc74d3b583bdcec2f37e6245a8ac003b8faa80923
+ENV PG_VERSION 14.13
+ENV PG_SHA256 59aa3c4b495ab26a9ec69f3ad0a0228c51f0fe6facf3634dfad4d1197d613a56
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -191,11 +192,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_14-bookworm/Dockerfile b/postgres_14-bookworm/Dockerfile
index 3c9e737..88743d5 100644
--- a/postgres_14-bookworm/Dockerfile
+++ b/postgres_14-bookworm/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 14
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 14.12-1.pgdg120+1
+ENV PG_VERSION 14.13-1.pgdg120+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_14-bullseye/Dockerfile b/postgres_14-bullseye/Dockerfile
index 048b473..a69d409 100644
--- a/postgres_14-bullseye/Dockerfile
+++ b/postgres_14-bullseye/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 14
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 14.12-1.pgdg110+1
+ENV PG_VERSION 14.13-1.pgdg110+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_15-alpine/Dockerfile b/postgres_15-alpine/Dockerfile
index 79b20ac..83e8a46 100644
--- a/postgres_15-alpine/Dockerfile
+++ b/postgres_15-alpine/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.20
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 15
-ENV PG_VERSION 15.7
-ENV PG_SHA256 a46fe49485ab6385e39dabbbb654f5d3049206f76cd695e224268729520998f7
+ENV PG_VERSION 15.8
+ENV PG_SHA256 4403515f9a69eeb3efebc98f30b8c696122bfdf895e92b3b23f5b8e769edcb6a
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -194,11 +195,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_15-alpine3.19/Dockerfile b/postgres_15-alpine3.19/Dockerfile
index 2f249aa..e9c2dbb 100644
--- a/postgres_15-alpine3.19/Dockerfile
+++ b/postgres_15-alpine3.19/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.19
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 15
-ENV PG_VERSION 15.7
-ENV PG_SHA256 a46fe49485ab6385e39dabbbb654f5d3049206f76cd695e224268729520998f7
+ENV PG_VERSION 15.8
+ENV PG_SHA256 4403515f9a69eeb3efebc98f30b8c696122bfdf895e92b3b23f5b8e769edcb6a
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -194,11 +195,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_15-bookworm/Dockerfile b/postgres_15-bookworm/Dockerfile
index 20dc81d..859acbf 100644
--- a/postgres_15-bookworm/Dockerfile
+++ b/postgres_15-bookworm/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 15
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 15.7-1.pgdg120+1
+ENV PG_VERSION 15.8-1.pgdg120+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_15-bullseye/Dockerfile b/postgres_15-bullseye/Dockerfile
index a8a5689..aff946f 100644
--- a/postgres_15-bullseye/Dockerfile
+++ b/postgres_15-bullseye/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 15
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 15.7-1.pgdg110+1
+ENV PG_VERSION 15.8-1.pgdg110+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_17beta2-alpine/Dockerfile b/postgres_17beta3-alpine/Dockerfile
similarity index 94%
rename from postgres_17beta2-alpine/Dockerfile
rename to postgres_17beta3-alpine/Dockerfile
index 5d71797..c8c6654 100644
--- a/postgres_17beta2-alpine/Dockerfile
+++ b/postgres_17beta3-alpine/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.20
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -51,8 +52,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 17
-ENV PG_VERSION 17beta2
-ENV PG_SHA256 157af3af2cbc40364990835f518aea0711703e1c48f204b54dfd49b46cd8716c
+ENV PG_VERSION 17beta3
+ENV PG_SHA256 010dfaff9fcca6afa2fd576eea89cdabcefc262aa0ba89a6845eaab4d4b08f71
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -191,11 +192,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_17beta2-alpine/docker-ensure-initdb.sh b/postgres_17beta3-alpine/docker-ensure-initdb.sh
similarity index 100%
rename from postgres_17beta2-alpine/docker-ensure-initdb.sh
rename to postgres_17beta3-alpine/docker-ensure-initdb.sh
diff --git a/postgres_17beta2-alpine/docker-entrypoint.sh b/postgres_17beta3-alpine/docker-entrypoint.sh
similarity index 100%
rename from postgres_17beta2-alpine/docker-entrypoint.sh
rename to postgres_17beta3-alpine/docker-entrypoint.sh
diff --git a/postgres_17beta2-alpine3.19/Dockerfile b/postgres_17beta3-alpine3.19/Dockerfile
similarity index 94%
rename from postgres_17beta2-alpine3.19/Dockerfile
rename to postgres_17beta3-alpine3.19/Dockerfile
index b862b1f..b969aee 100644
--- a/postgres_17beta2-alpine3.19/Dockerfile
+++ b/postgres_17beta3-alpine3.19/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.19
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -51,8 +52,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 17
-ENV PG_VERSION 17beta2
-ENV PG_SHA256 157af3af2cbc40364990835f518aea0711703e1c48f204b54dfd49b46cd8716c
+ENV PG_VERSION 17beta3
+ENV PG_SHA256 010dfaff9fcca6afa2fd576eea89cdabcefc262aa0ba89a6845eaab4d4b08f71
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -191,11 +192,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_17beta2-alpine3.19/docker-ensure-initdb.sh b/postgres_17beta3-alpine3.19/docker-ensure-initdb.sh
similarity index 100%
rename from postgres_17beta2-alpine3.19/docker-ensure-initdb.sh
rename to postgres_17beta3-alpine3.19/docker-ensure-initdb.sh
diff --git a/postgres_17beta2-alpine3.19/docker-entrypoint.sh b/postgres_17beta3-alpine3.19/docker-entrypoint.sh
similarity index 100%
rename from postgres_17beta2-alpine3.19/docker-entrypoint.sh
rename to postgres_17beta3-alpine3.19/docker-entrypoint.sh
diff --git a/postgres_17beta2-bookworm/Dockerfile b/postgres_17beta3-bookworm/Dockerfile
similarity index 96%
rename from postgres_17beta2-bookworm/Dockerfile
rename to postgres_17beta3-bookworm/Dockerfile
index 44a83ef..4f6df7d 100644
--- a/postgres_17beta2-bookworm/Dockerfile
+++ b/postgres_17beta3-bookworm/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 17
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 17~beta2-1.pgdg120+1
+ENV PG_VERSION 17~beta3-1.pgdg120+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_17beta2-bookworm/docker-ensure-initdb.sh b/postgres_17beta3-bookworm/docker-ensure-initdb.sh
similarity index 100%
rename from postgres_17beta2-bookworm/docker-ensure-initdb.sh
rename to postgres_17beta3-bookworm/docker-ensure-initdb.sh
diff --git a/postgres_17beta2-bookworm/docker-entrypoint.sh b/postgres_17beta3-bookworm/docker-entrypoint.sh
similarity index 100%
rename from postgres_17beta2-bookworm/docker-entrypoint.sh
rename to postgres_17beta3-bookworm/docker-entrypoint.sh
diff --git a/postgres_17beta2-bullseye/Dockerfile b/postgres_17beta3-bullseye/Dockerfile
similarity index 96%
rename from postgres_17beta2-bullseye/Dockerfile
rename to postgres_17beta3-bullseye/Dockerfile
index e93e7e4..8da5fa7 100644
--- a/postgres_17beta2-bullseye/Dockerfile
+++ b/postgres_17beta3-bullseye/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 17
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 17~beta2-1.pgdg110+1
+ENV PG_VERSION 17~beta3-1.pgdg110+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_17beta2-bullseye/docker-ensure-initdb.sh b/postgres_17beta3-bullseye/docker-ensure-initdb.sh
similarity index 100%
rename from postgres_17beta2-bullseye/docker-ensure-initdb.sh
rename to postgres_17beta3-bullseye/docker-ensure-initdb.sh
diff --git a/postgres_17beta2-bullseye/docker-entrypoint.sh b/postgres_17beta3-bullseye/docker-entrypoint.sh
similarity index 100%
rename from postgres_17beta2-bullseye/docker-entrypoint.sh
rename to postgres_17beta3-bullseye/docker-entrypoint.sh
diff --git a/postgres_alpine/Dockerfile b/postgres_alpine/Dockerfile
index b7606c5..33d0109 100644
--- a/postgres_alpine/Dockerfile
+++ b/postgres_alpine/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.20
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 16
-ENV PG_VERSION 16.3
-ENV PG_SHA256 331963d5d3dc4caf4216a049fa40b66d6bcb8c730615859411b9518764e60585
+ENV PG_VERSION 16.4
+ENV PG_SHA256 971766d645aa73e93b9ef4e3be44201b4f45b5477095b049125403f9f3386d6f
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -193,11 +194,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_alpine3.19/Dockerfile b/postgres_alpine3.19/Dockerfile
index f949bbb..16f3df5 100644
--- a/postgres_alpine3.19/Dockerfile
+++ b/postgres_alpine3.19/Dockerfile
@@ -11,8 +11,9 @@ FROM alpine:3.19
 RUN set -eux; \
 	addgroup -g 70 -S postgres; \
 	adduser -u 70 -S -D -G postgres -H -h /var/lib/postgresql -s /bin/sh postgres; \
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+# also create the postgres user's home directory with appropriate permissions
+# see https://github.com/docker-library/postgres/issues/274
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 # grab gosu for easy step-down from root
 # https://github.com/tianon/gosu/releases
@@ -52,8 +53,8 @@ ENV LANG en_US.utf8
 RUN mkdir /docker-entrypoint-initdb.d
 
 ENV PG_MAJOR 16
-ENV PG_VERSION 16.3
-ENV PG_SHA256 331963d5d3dc4caf4216a049fa40b66d6bcb8c730615859411b9518764e60585
+ENV PG_VERSION 16.4
+ENV PG_SHA256 971766d645aa73e93b9ef4e3be44201b4f45b5477095b049125403f9f3386d6f
 
 ENV DOCKER_PG_LLVM_DEPS \
 		llvm15-dev \
@@ -193,11 +194,11 @@ RUN set -eux; \
 	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 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_bookworm/Dockerfile b/postgres_bookworm/Dockerfile
index 9983d85..c18ea69 100644
--- a/postgres_bookworm/Dockerfile
+++ b/postgres_bookworm/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 16
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 16.3-1.pgdg120+1
+ENV PG_VERSION 16.4-1.pgdg120+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
diff --git a/postgres_bullseye/Dockerfile b/postgres_bullseye/Dockerfile
index b4146f0..012558e 100644
--- a/postgres_bullseye/Dockerfile
+++ b/postgres_bullseye/Dockerfile
@@ -13,8 +13,7 @@ RUN set -eux; \
 	useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
 # also create the postgres user's home directory with appropriate permissions
 # see https://github.com/docker-library/postgres/issues/274
-	mkdir -p /var/lib/postgresql; \
-	chown -R postgres:postgres /var/lib/postgresql
+	install --verbose --directory --owner postgres --group postgres --mode 1777 /var/lib/postgresql
 
 RUN set -ex; \
 	apt-get update; \
@@ -90,7 +89,7 @@ RUN set -ex; \
 ENV PG_MAJOR 16
 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
 
-ENV PG_VERSION 16.3-1.pgdg110+1
+ENV PG_VERSION 16.4-1.pgdg110+1
 
 RUN set -ex; \
 	\
@@ -181,11 +180,11 @@ RUN set -eux; \
 	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
 
-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 3777 /var/run/postgresql
+RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql
 
 ENV PGDATA /var/lib/postgresql/data
 # this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 1777 "$PGDATA"
+RUN install --verbose --directory --owner postgres --group postgres --mode 1777 "$PGDATA"
 VOLUME /var/lib/postgresql/data
 
 COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/

Relevant Maintainers:

@yosifkit yosifkit merged commit 3896822 into docker-library:master Aug 8, 2024
29 checks passed
@yosifkit yosifkit deleted the postgres branch August 8, 2024 18:15
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.

3 participants