From 064113e0e481a1d0542846b81858e457fde02c90 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 21 Aug 2018 14:39:06 -0700 Subject: [PATCH] Add "stretch-backports" to 11+ for clang-6.0 (also, remove *.pyc files for size) --- 10/Dockerfile | 17 ++++++++++++++++- 11/Dockerfile | 17 ++++++++++++++++- 9.3/Dockerfile | 17 ++++++++++++++++- 9.4/Dockerfile | 17 ++++++++++++++++- 9.5/Dockerfile | 17 ++++++++++++++++- 9.6/Dockerfile | 17 ++++++++++++++++- Dockerfile-debian.template | 17 ++++++++++++++++- 7 files changed, 112 insertions(+), 7 deletions(-) diff --git a/10/Dockerfile b/10/Dockerfile index 3e2407a9ce..e4185e4e0d 100644 --- a/10/Dockerfile +++ b/10/Dockerfile @@ -75,6 +75,9 @@ ENV PG_VERSION 10.5-1.pgdg90+1 RUN set -ex; \ \ +# see note below about "*.pyc" files + export PYTHONDONTWRITEBYTECODE=1; \ + \ dpkgArch="$(dpkg --print-architecture)"; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ @@ -87,6 +90,15 @@ 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"; \ \ @@ -135,7 +147,10 @@ RUN set -ex; \ # if we have leftovers from building, let's purge them (including extra, unnecessary build deps) apt-get purge -y --auto-remove; \ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \ - fi + 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' -- '{}' + # make the sample config easier to munge (and "correct by default") RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \ diff --git a/11/Dockerfile b/11/Dockerfile index 494ceb6e8f..3044c31c2c 100644 --- a/11/Dockerfile +++ b/11/Dockerfile @@ -75,6 +75,9 @@ ENV PG_VERSION 11~beta3-1.pgdg90+2 RUN set -ex; \ \ +# see note below about "*.pyc" files + export PYTHONDONTWRITEBYTECODE=1; \ + \ dpkgArch="$(dpkg --print-architecture)"; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ @@ -87,6 +90,15 @@ 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"; \ \ @@ -135,7 +147,10 @@ RUN set -ex; \ # if we have leftovers from building, let's purge them (including extra, unnecessary build deps) apt-get purge -y --auto-remove; \ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \ - fi + 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' -- '{}' + # make the sample config easier to munge (and "correct by default") RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \ diff --git a/9.3/Dockerfile b/9.3/Dockerfile index 02d20e252a..10d2bfe63e 100644 --- a/9.3/Dockerfile +++ b/9.3/Dockerfile @@ -75,6 +75,9 @@ ENV PG_VERSION 9.3.24-1.pgdg90+1 RUN set -ex; \ \ +# see note below about "*.pyc" files + export PYTHONDONTWRITEBYTECODE=1; \ + \ dpkgArch="$(dpkg --print-architecture)"; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ @@ -87,6 +90,15 @@ 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"; \ \ @@ -136,7 +148,10 @@ RUN set -ex; \ # if we have leftovers from building, let's purge them (including extra, unnecessary build deps) apt-get purge -y --auto-remove; \ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \ - fi + 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' -- '{}' + # make the sample config easier to munge (and "correct by default") RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \ diff --git a/9.4/Dockerfile b/9.4/Dockerfile index efbccf41de..d245e0c733 100644 --- a/9.4/Dockerfile +++ b/9.4/Dockerfile @@ -75,6 +75,9 @@ ENV PG_VERSION 9.4.19-1.pgdg90+1 RUN set -ex; \ \ +# see note below about "*.pyc" files + export PYTHONDONTWRITEBYTECODE=1; \ + \ dpkgArch="$(dpkg --print-architecture)"; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ @@ -87,6 +90,15 @@ 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"; \ \ @@ -136,7 +148,10 @@ RUN set -ex; \ # if we have leftovers from building, let's purge them (including extra, unnecessary build deps) apt-get purge -y --auto-remove; \ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \ - fi + 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' -- '{}' + # make the sample config easier to munge (and "correct by default") RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \ diff --git a/9.5/Dockerfile b/9.5/Dockerfile index de5f9b9152..eac77c15d3 100644 --- a/9.5/Dockerfile +++ b/9.5/Dockerfile @@ -75,6 +75,9 @@ ENV PG_VERSION 9.5.14-1.pgdg90+1 RUN set -ex; \ \ +# see note below about "*.pyc" files + export PYTHONDONTWRITEBYTECODE=1; \ + \ dpkgArch="$(dpkg --print-architecture)"; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ @@ -87,6 +90,15 @@ 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"; \ \ @@ -136,7 +148,10 @@ RUN set -ex; \ # if we have leftovers from building, let's purge them (including extra, unnecessary build deps) apt-get purge -y --auto-remove; \ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \ - fi + 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' -- '{}' + # make the sample config easier to munge (and "correct by default") RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \ diff --git a/9.6/Dockerfile b/9.6/Dockerfile index 02773791c2..4ef1423119 100644 --- a/9.6/Dockerfile +++ b/9.6/Dockerfile @@ -75,6 +75,9 @@ ENV PG_VERSION 9.6.10-1.pgdg90+1 RUN set -ex; \ \ +# see note below about "*.pyc" files + export PYTHONDONTWRITEBYTECODE=1; \ + \ dpkgArch="$(dpkg --print-architecture)"; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ @@ -87,6 +90,15 @@ 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"; \ \ @@ -136,7 +148,10 @@ RUN set -ex; \ # if we have leftovers from building, let's purge them (including extra, unnecessary build deps) apt-get purge -y --auto-remove; \ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \ - fi + 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' -- '{}' + # make the sample config easier to munge (and "correct by default") RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index db2655f594..9e2af40500 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -75,6 +75,9 @@ ENV PG_VERSION %%PG_VERSION%% RUN set -ex; \ \ +# see note below about "*.pyc" files + export PYTHONDONTWRITEBYTECODE=1; \ + \ dpkgArch="$(dpkg --print-architecture)"; \ case "$dpkgArch" in \ %%ARCH_LIST%%) \ @@ -87,6 +90,15 @@ RUN set -ex; \ # let's build binaries from their published source packages echo "deb-src http://apt.postgresql.org/pub/repos/apt/ %%DEBIAN_SUITE%%-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 %%DEBIAN_SUITE%%-backports main' >> /etc/apt/sources.list.d/pgdg.list; \ + ;; \ + esac; \ + \ tempDir="$(mktemp -d)"; \ cd "$tempDir"; \ \ @@ -136,7 +148,10 @@ RUN set -ex; \ # if we have leftovers from building, let's purge them (including extra, unnecessary build deps) apt-get purge -y --auto-remove; \ rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \ - fi + 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' -- '{}' + # make the sample config easier to munge (and "correct by default") RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \