diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 3d6236e6e8..3bcc57159e 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -203,7 +203,9 @@ RUN set -eux; \ # make the sample config easier to munge (and "correct by default") RUN set -eux; \ - cp -v /usr/local/share/postgresql/postgresql.conf.sample /usr/local/share/postgresql/postgresql.conf.sample.orig; \ + mkdir -p /etc/postgresql/conf.d; \ + mv -v /usr/local/share/postgresql/postgresql.conf.sample /usr/local/share/postgresql/postgresql.conf.sample.orig; \ + awk '/# CONFIG FILE INCLUDES/ {print; getline; print; print "\ninclude_dir = '\''/etc/postgresql/conf.d'\''"; next} 1' /usr/local/share/postgresql/postgresql.conf.sample.orig > /usr/local/share/postgresql/postgresql.conf.sample; \ 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 diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 1fa84903ac..a720a19165 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -173,10 +173,11 @@ RUN set -ex; \ # make the sample config easier to munge (and "correct by default") RUN set -eux; \ dpkg-divert --add --rename --divert "/usr/share/postgresql/postgresql.conf.sample.dpkg" "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample"; \ - cp -v /usr/share/postgresql/postgresql.conf.sample.dpkg /usr/share/postgresql/postgresql.conf.sample; \ - ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/"; \ + mkdir -p /etc/postgresql/conf.d; \ + awk '/# CONFIG FILE INCLUDES/ {print; getline; print; print "\ninclude_dir = '\''/etc/postgresql/conf.d'\''"; next} 1' /usr/share/postgresql/postgresql.conf.sample.dpkg > /usr/share/postgresql/postgresql.conf.sample; \ 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 + grep -F "listen_addresses = '*'" /usr/share/postgresql/postgresql.conf.sample; \ + ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/"; RUN install --verbose --directory --owner postgres --group postgres --mode 3777 /var/run/postgresql