Merge ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:resync-20.04-with-21.04 into ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:edge

Proposed by Bryce Harrington
Status: Merged
Merge reported by: Bryce Harrington
Merged at revision: ed4f08e2a330c89aa7b6bbecac620b8e84d5c90e
Proposed branch: ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:resync-20.04-with-21.04
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/postgresql:edge
Diff against target: 104 lines (+27/-28)
1 file modified
Dockerfile (+27/-28)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior Approve
Canonical Server Pending
Review via email: mp+400066@code.launchpad.net

Description of the change

Resync with Dockerfile from the 21.04 branch

Note: Due to the glibc/runc issue we've not been able to successfully build/deploy
the 21.04 OCI image, so we lack positive confirmation on these changes.
So review carefully, but I think these changes should all be safe.

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks.

I have carefully reviewed everything, and the changes seem fine. I also confirmed that the new Dockerfile builds and tests fine. I'm leaving two small comments to be addressed, but other than that this LGTM, so I'm approving it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Dockerfile b/Dockerfile
2index c576d7b..664227a 100644
3--- a/Dockerfile
4+++ b/Dockerfile
5@@ -6,56 +6,50 @@ ENV TZ UTC
6 # explicitly set user/group IDs
7 RUN set -eux; \
8 groupadd -r postgres --gid=999; \
9+ groupadd -r ssl-cert --gid=998; \
10 # https://salsa.debian.org/postgresql/postgresql-common/blob/997d842ee744687d99a2b2d95c1083a2615c79e8/debian/postgresql-common.postinst#L32-35
11- useradd -r -g postgres --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
12+ useradd -r -g postgres -G ssl-cert --uid=999 --home-dir=/var/lib/postgresql --shell=/bin/bash postgres; \
13 # also create the postgres user's home directory with appropriate permissions
14 # see https://github.com/docker-library/postgres/issues/274
15 mkdir -p /var/lib/postgresql; \
16- chown -R postgres:postgres /var/lib/postgresql
17-
18-RUN set -eux; \
19- apt-get update; \
20- DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gosu; \
21- rm -rf /var/lib/apt/lists/*; \
22- gosu nobody true
23+ chown -R postgres:postgres /var/lib/postgresql;
24
25 # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default
26 RUN set -eux; \
27- if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \
28-# if this file exists, we're likely in "debian:xxx-slim", and locales are thus being excluded so we need to remove that exclusion (since we need locales)
29- grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
30- sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \
31- ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \
32- fi; \
33 apt-get update; \
34- DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends locales tzdata; rm -rf /var/lib/apt/lists/*; \
35- localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
36+ DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y; \
37+ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
38+ locales \
39+ tzdata \
40+# Required by entrypoint script
41+ gosu \
42+ ; \
43+ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8;
44 ENV LANG en_US.utf8
45
46 RUN mkdir /docker-entrypoint-initdb.d
47
48 ENV PG_MAJOR 12
49
50-RUN set -ex; \
51- \
52-# see note below about "*.pyc" files
53+RUN set -eux; \
54+# installation
55 export PYTHONDONTWRITEBYTECODE=1; \
56- apt-get update; \
57- DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends postgresql-common; \
58+ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
59+ postgresql-common; \
60 sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf; \
61 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
62 "postgresql-$PG_MAJOR" \
63 "postgresql-contrib-$PG_MAJOR" \
64- ; \
65- \
66+ ; \
67+ DEBIAN_FRONTEND=noninteractive apt-get remove --purge --auto-remove -y; \
68 rm -rf /var/lib/apt/lists/*; \
69- \
70+# NOTE:
71 # 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)
72 # XXX check
73 find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +; \
74 # create manifest
75 mkdir -p /usr/share/rocks; \
76- (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > /usr/share/rocks/dpkg.query
77+ (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > /usr/share/rocks/dpkg.query;
78
79 # make the sample config easier to munge (and "correct by default")
80 # XXX check - divert? why?
81@@ -64,15 +58,20 @@ RUN set -eux; \
82 cp -v /usr/share/postgresql/postgresql.conf.sample.dpkg /usr/share/postgresql/postgresql.conf.sample; \
83 ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/"; \
84 sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample; \
85- grep -F "listen_addresses = '*'" /usr/share/postgresql/postgresql.conf.sample
86+ grep -F "listen_addresses = '*'" /usr/share/postgresql/postgresql.conf.sample;
87
88-RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
89+RUN set -eux; \
90+ mkdir -p /var/run/postgresql; \
91+ chown -R postgres:postgres /var/run/postgresql; \
92+ chmod 2777 /var/run/postgresql;
93
94 ENV PATH $PATH:/usr/lib/postgresql/$PG_MAJOR/bin
95 ENV PGDATA /var/lib/postgresql/data
96 # this 777 will be replaced by 700 at runtime (allows semi-arbitrary "--user" values)
97 # XXX check
98-RUN mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA" && chmod 777 "$PGDATA"
99+RUN mkdir -p "$PGDATA"; \
100+ chown -R postgres:postgres "$PGDATA"; \
101+ chmod 777 "$PGDATA";
102 VOLUME /var/lib/postgresql/data
103
104 COPY docker-entrypoint.sh /usr/local/bin/

Subscribers

People subscribed via source and target branches

to all changes: