Skip to content

Commit 064113e

Browse files
committed
Add "stretch-backports" to 11+ for clang-6.0
(also, remove *.pyc files for size)
1 parent 35d6f4b commit 064113e

File tree

7 files changed

+112
-7
lines changed

7 files changed

+112
-7
lines changed

10/Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ ENV PG_VERSION 10.5-1.pgdg90+1
7575

7676
RUN set -ex; \
7777
\
78+
# see note below about "*.pyc" files
79+
export PYTHONDONTWRITEBYTECODE=1; \
80+
\
7881
dpkgArch="$(dpkg --print-architecture)"; \
7982
case "$dpkgArch" in \
8083
amd64|i386|ppc64el) \
@@ -87,6 +90,15 @@ RUN set -ex; \
8790
# let's build binaries from their published source packages
8891
echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
8992
\
93+
case "$PG_MAJOR" in \
94+
9.* | 10 ) ;; \
95+
*) \
96+
# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
97+
# TODO remove this once we hit buster+
98+
echo 'deb http://deb.debian.org/debian stretch-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
99+
;; \
100+
esac; \
101+
\
90102
tempDir="$(mktemp -d)"; \
91103
cd "$tempDir"; \
92104
\
@@ -135,7 +147,10 @@ RUN set -ex; \
135147
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
136148
apt-get purge -y --auto-remove; \
137149
rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
138-
fi
150+
fi; \
151+
\
152+
# 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)
153+
find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
139154

140155
# make the sample config easier to munge (and "correct by default")
141156
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \

11/Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ ENV PG_VERSION 11~beta3-1.pgdg90+2
7575

7676
RUN set -ex; \
7777
\
78+
# see note below about "*.pyc" files
79+
export PYTHONDONTWRITEBYTECODE=1; \
80+
\
7881
dpkgArch="$(dpkg --print-architecture)"; \
7982
case "$dpkgArch" in \
8083
amd64|i386|ppc64el) \
@@ -87,6 +90,15 @@ RUN set -ex; \
8790
# let's build binaries from their published source packages
8891
echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
8992
\
93+
case "$PG_MAJOR" in \
94+
9.* | 10 ) ;; \
95+
*) \
96+
# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
97+
# TODO remove this once we hit buster+
98+
echo 'deb http://deb.debian.org/debian stretch-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
99+
;; \
100+
esac; \
101+
\
90102
tempDir="$(mktemp -d)"; \
91103
cd "$tempDir"; \
92104
\
@@ -135,7 +147,10 @@ RUN set -ex; \
135147
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
136148
apt-get purge -y --auto-remove; \
137149
rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
138-
fi
150+
fi; \
151+
\
152+
# 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)
153+
find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
139154

140155
# make the sample config easier to munge (and "correct by default")
141156
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \

9.3/Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ ENV PG_VERSION 9.3.24-1.pgdg90+1
7575

7676
RUN set -ex; \
7777
\
78+
# see note below about "*.pyc" files
79+
export PYTHONDONTWRITEBYTECODE=1; \
80+
\
7881
dpkgArch="$(dpkg --print-architecture)"; \
7982
case "$dpkgArch" in \
8083
amd64|i386|ppc64el) \
@@ -87,6 +90,15 @@ RUN set -ex; \
8790
# let's build binaries from their published source packages
8891
echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
8992
\
93+
case "$PG_MAJOR" in \
94+
9.* | 10 ) ;; \
95+
*) \
96+
# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
97+
# TODO remove this once we hit buster+
98+
echo 'deb http://deb.debian.org/debian stretch-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
99+
;; \
100+
esac; \
101+
\
90102
tempDir="$(mktemp -d)"; \
91103
cd "$tempDir"; \
92104
\
@@ -136,7 +148,10 @@ RUN set -ex; \
136148
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
137149
apt-get purge -y --auto-remove; \
138150
rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
139-
fi
151+
fi; \
152+
\
153+
# 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)
154+
find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
140155

141156
# make the sample config easier to munge (and "correct by default")
142157
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \

9.4/Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ ENV PG_VERSION 9.4.19-1.pgdg90+1
7575

7676
RUN set -ex; \
7777
\
78+
# see note below about "*.pyc" files
79+
export PYTHONDONTWRITEBYTECODE=1; \
80+
\
7881
dpkgArch="$(dpkg --print-architecture)"; \
7982
case "$dpkgArch" in \
8083
amd64|i386|ppc64el) \
@@ -87,6 +90,15 @@ RUN set -ex; \
8790
# let's build binaries from their published source packages
8891
echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
8992
\
93+
case "$PG_MAJOR" in \
94+
9.* | 10 ) ;; \
95+
*) \
96+
# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
97+
# TODO remove this once we hit buster+
98+
echo 'deb http://deb.debian.org/debian stretch-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
99+
;; \
100+
esac; \
101+
\
90102
tempDir="$(mktemp -d)"; \
91103
cd "$tempDir"; \
92104
\
@@ -136,7 +148,10 @@ RUN set -ex; \
136148
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
137149
apt-get purge -y --auto-remove; \
138150
rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
139-
fi
151+
fi; \
152+
\
153+
# 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)
154+
find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
140155

141156
# make the sample config easier to munge (and "correct by default")
142157
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \

9.5/Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ ENV PG_VERSION 9.5.14-1.pgdg90+1
7575

7676
RUN set -ex; \
7777
\
78+
# see note below about "*.pyc" files
79+
export PYTHONDONTWRITEBYTECODE=1; \
80+
\
7881
dpkgArch="$(dpkg --print-architecture)"; \
7982
case "$dpkgArch" in \
8083
amd64|i386|ppc64el) \
@@ -87,6 +90,15 @@ RUN set -ex; \
8790
# let's build binaries from their published source packages
8891
echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
8992
\
93+
case "$PG_MAJOR" in \
94+
9.* | 10 ) ;; \
95+
*) \
96+
# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
97+
# TODO remove this once we hit buster+
98+
echo 'deb http://deb.debian.org/debian stretch-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
99+
;; \
100+
esac; \
101+
\
90102
tempDir="$(mktemp -d)"; \
91103
cd "$tempDir"; \
92104
\
@@ -136,7 +148,10 @@ RUN set -ex; \
136148
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
137149
apt-get purge -y --auto-remove; \
138150
rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
139-
fi
151+
fi; \
152+
\
153+
# 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)
154+
find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
140155

141156
# make the sample config easier to munge (and "correct by default")
142157
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \

9.6/Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ ENV PG_VERSION 9.6.10-1.pgdg90+1
7575

7676
RUN set -ex; \
7777
\
78+
# see note below about "*.pyc" files
79+
export PYTHONDONTWRITEBYTECODE=1; \
80+
\
7881
dpkgArch="$(dpkg --print-architecture)"; \
7982
case "$dpkgArch" in \
8083
amd64|i386|ppc64el) \
@@ -87,6 +90,15 @@ RUN set -ex; \
8790
# let's build binaries from their published source packages
8891
echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
8992
\
93+
case "$PG_MAJOR" in \
94+
9.* | 10 ) ;; \
95+
*) \
96+
# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
97+
# TODO remove this once we hit buster+
98+
echo 'deb http://deb.debian.org/debian stretch-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
99+
;; \
100+
esac; \
101+
\
90102
tempDir="$(mktemp -d)"; \
91103
cd "$tempDir"; \
92104
\
@@ -136,7 +148,10 @@ RUN set -ex; \
136148
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
137149
apt-get purge -y --auto-remove; \
138150
rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
139-
fi
151+
fi; \
152+
\
153+
# 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)
154+
find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
140155

141156
# make the sample config easier to munge (and "correct by default")
142157
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \

Dockerfile-debian.template

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ ENV PG_VERSION %%PG_VERSION%%
7575

7676
RUN set -ex; \
7777
\
78+
# see note below about "*.pyc" files
79+
export PYTHONDONTWRITEBYTECODE=1; \
80+
\
7881
dpkgArch="$(dpkg --print-architecture)"; \
7982
case "$dpkgArch" in \
8083
%%ARCH_LIST%%) \
@@ -87,6 +90,15 @@ RUN set -ex; \
8790
# let's build binaries from their published source packages
8891
echo "deb-src http://apt.postgresql.org/pub/repos/apt/ %%DEBIAN_SUITE%%-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \
8992
\
93+
case "$PG_MAJOR" in \
94+
9.* | 10 ) ;; \
95+
*) \
96+
# https://github.com/docker-library/postgres/issues/484 (clang-6.0 required, only available in stretch-backports)
97+
# TODO remove this once we hit buster+
98+
echo 'deb http://deb.debian.org/debian %%DEBIAN_SUITE%%-backports main' >> /etc/apt/sources.list.d/pgdg.list; \
99+
;; \
100+
esac; \
101+
\
90102
tempDir="$(mktemp -d)"; \
91103
cd "$tempDir"; \
92104
\
@@ -136,7 +148,10 @@ RUN set -ex; \
136148
# if we have leftovers from building, let's purge them (including extra, unnecessary build deps)
137149
apt-get purge -y --auto-remove; \
138150
rm -rf "$tempDir" /etc/apt/sources.list.d/temp.list; \
139-
fi
151+
fi; \
152+
\
153+
# 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)
154+
find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
140155

141156
# make the sample config easier to munge (and "correct by default")
142157
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \

0 commit comments

Comments
 (0)