From ef4545c07bd97e5585bb9e7f2680a4859b9ccf3c Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 23 Apr 2018 15:16:30 -0700 Subject: [PATCH] Update to Debian Stretch (slim) --- 10/Dockerfile | 13 ++++++++++--- 9.3/Dockerfile | 19 +++++++++++++------ 9.4/Dockerfile | 19 +++++++++++++------ 9.5/Dockerfile | 19 +++++++++++++------ 9.6/Dockerfile | 19 +++++++++++++------ Dockerfile-debian.template | 13 ++++++++++--- update.sh | 11 +++++------ 7 files changed, 77 insertions(+), 36 deletions(-) diff --git a/10/Dockerfile b/10/Dockerfile index 8804367ba8..378c91df2b 100644 --- a/10/Dockerfile +++ b/10/Dockerfile @@ -1,5 +1,5 @@ # vim:set ft=dockerfile: -FROM debian:stretch +FROM debian:stretch-slim RUN set -ex; \ if ! command -v gpg > /dev/null; then \ @@ -29,8 +29,15 @@ RUN set -x \ && apt-get purge -y --auto-remove ca-certificates wget # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default -RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ - && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +RUN set -eux; \ + if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \ +# 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) + grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \ + ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + fi; \ + apt-get update; apt-get install -y locales; rm -rf /var/lib/apt/lists/*; \ + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8 RUN mkdir /docker-entrypoint-initdb.d diff --git a/9.3/Dockerfile b/9.3/Dockerfile index 3f8b5c0807..7bb3abb731 100644 --- a/9.3/Dockerfile +++ b/9.3/Dockerfile @@ -1,5 +1,5 @@ # vim:set ft=dockerfile: -FROM debian:jessie +FROM debian:stretch-slim RUN set -ex; \ if ! command -v gpg > /dev/null; then \ @@ -29,8 +29,15 @@ RUN set -x \ && apt-get purge -y --auto-remove ca-certificates wget # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default -RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ - && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +RUN set -eux; \ + if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \ +# 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) + grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \ + ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + fi; \ + apt-get update; apt-get install -y locales; rm -rf /var/lib/apt/lists/*; \ + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8 RUN mkdir /docker-entrypoint-initdb.d @@ -47,7 +54,7 @@ RUN set -ex; \ apt-key list ENV PG_MAJOR 9.3 -ENV PG_VERSION 9.3.22-1.pgdg80+1 +ENV PG_VERSION 9.3.22-1.pgdg90+1 RUN set -ex; \ \ @@ -55,13 +62,13 @@ RUN set -ex; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ # arches officialy built by upstream - echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ + echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ apt-get update; \ ;; \ *) \ # we're on an architecture upstream doesn't officially build for # let's build binaries from their published source packages - echo "deb-src http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ + echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ \ tempDir="$(mktemp -d)"; \ cd "$tempDir"; \ diff --git a/9.4/Dockerfile b/9.4/Dockerfile index 125ba689b2..17d6a9acaf 100644 --- a/9.4/Dockerfile +++ b/9.4/Dockerfile @@ -1,5 +1,5 @@ # vim:set ft=dockerfile: -FROM debian:jessie +FROM debian:stretch-slim RUN set -ex; \ if ! command -v gpg > /dev/null; then \ @@ -29,8 +29,15 @@ RUN set -x \ && apt-get purge -y --auto-remove ca-certificates wget # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default -RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ - && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +RUN set -eux; \ + if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \ +# 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) + grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \ + ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + fi; \ + apt-get update; apt-get install -y locales; rm -rf /var/lib/apt/lists/*; \ + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8 RUN mkdir /docker-entrypoint-initdb.d @@ -47,7 +54,7 @@ RUN set -ex; \ apt-key list ENV PG_MAJOR 9.4 -ENV PG_VERSION 9.4.17-1.pgdg80+1 +ENV PG_VERSION 9.4.17-1.pgdg90+1 RUN set -ex; \ \ @@ -55,13 +62,13 @@ RUN set -ex; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ # arches officialy built by upstream - echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ + echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ apt-get update; \ ;; \ *) \ # we're on an architecture upstream doesn't officially build for # let's build binaries from their published source packages - echo "deb-src http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ + echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ \ tempDir="$(mktemp -d)"; \ cd "$tempDir"; \ diff --git a/9.5/Dockerfile b/9.5/Dockerfile index 1eb3221c25..81b8513195 100644 --- a/9.5/Dockerfile +++ b/9.5/Dockerfile @@ -1,5 +1,5 @@ # vim:set ft=dockerfile: -FROM debian:jessie +FROM debian:stretch-slim RUN set -ex; \ if ! command -v gpg > /dev/null; then \ @@ -29,8 +29,15 @@ RUN set -x \ && apt-get purge -y --auto-remove ca-certificates wget # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default -RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ - && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +RUN set -eux; \ + if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \ +# 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) + grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \ + ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + fi; \ + apt-get update; apt-get install -y locales; rm -rf /var/lib/apt/lists/*; \ + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8 RUN mkdir /docker-entrypoint-initdb.d @@ -47,7 +54,7 @@ RUN set -ex; \ apt-key list ENV PG_MAJOR 9.5 -ENV PG_VERSION 9.5.12-1.pgdg80+1 +ENV PG_VERSION 9.5.12-1.pgdg90+1 RUN set -ex; \ \ @@ -55,13 +62,13 @@ RUN set -ex; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ # arches officialy built by upstream - echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ + echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ apt-get update; \ ;; \ *) \ # we're on an architecture upstream doesn't officially build for # let's build binaries from their published source packages - echo "deb-src http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ + echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ \ tempDir="$(mktemp -d)"; \ cd "$tempDir"; \ diff --git a/9.6/Dockerfile b/9.6/Dockerfile index a6d04c356e..25c34c0f02 100644 --- a/9.6/Dockerfile +++ b/9.6/Dockerfile @@ -1,5 +1,5 @@ # vim:set ft=dockerfile: -FROM debian:jessie +FROM debian:stretch-slim RUN set -ex; \ if ! command -v gpg > /dev/null; then \ @@ -29,8 +29,15 @@ RUN set -x \ && apt-get purge -y --auto-remove ca-certificates wget # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default -RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ - && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +RUN set -eux; \ + if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \ +# 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) + grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \ + ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + fi; \ + apt-get update; apt-get install -y locales; rm -rf /var/lib/apt/lists/*; \ + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8 RUN mkdir /docker-entrypoint-initdb.d @@ -47,7 +54,7 @@ RUN set -ex; \ apt-key list ENV PG_MAJOR 9.6 -ENV PG_VERSION 9.6.8-1.pgdg80+1 +ENV PG_VERSION 9.6.8-1.pgdg90+1 RUN set -ex; \ \ @@ -55,13 +62,13 @@ RUN set -ex; \ case "$dpkgArch" in \ amd64|i386|ppc64el) \ # arches officialy built by upstream - echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ + echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ apt-get update; \ ;; \ *) \ # we're on an architecture upstream doesn't officially build for # let's build binaries from their published source packages - echo "deb-src http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ + echo "deb-src http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main $PG_MAJOR" > /etc/apt/sources.list.d/pgdg.list; \ \ tempDir="$(mktemp -d)"; \ cd "$tempDir"; \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index a66cab06c1..d0f3ed1540 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -1,5 +1,5 @@ # vim:set ft=dockerfile: -FROM debian:%%DEBIAN_SUITE%% +FROM debian:%%DEBIAN_TAG%% RUN set -ex; \ if ! command -v gpg > /dev/null; then \ @@ -29,8 +29,15 @@ RUN set -x \ && apt-get purge -y --auto-remove ca-certificates wget # make the "en_US.UTF-8" locale so postgres will be utf-8 enabled by default -RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \ - && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 +RUN set -eux; \ + if [ -f /etc/dpkg/dpkg.cfg.d/docker ]; then \ +# 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) + grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + sed -ri '/\/usr\/share\/locale/d' /etc/dpkg/dpkg.cfg.d/docker; \ + ! grep -q '/usr/share/locale' /etc/dpkg/dpkg.cfg.d/docker; \ + fi; \ + apt-get update; apt-get install -y locales; rm -rf /var/lib/apt/lists/*; \ + localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.utf8 RUN mkdir /docker-entrypoint-initdb.d diff --git a/update.sh b/update.sh index cc8df80244..eebaf8e6b7 100755 --- a/update.sh +++ b/update.sh @@ -9,12 +9,9 @@ if [ ${#versions[@]} -eq 0 ]; then fi versions=( "${versions[@]%/}" ) +defaultDebianSuite='stretch-slim' declare -A debianSuite=( - [9.3]='jessie' - [9.4]='jessie' - [9.5]='jessie' - [9.6]='jessie' - [10]='stretch' + #[9.6]='jessie' ) declare -A alpineVersion=( [9.3]='3.5' @@ -33,7 +30,8 @@ osspUuidHash='11a615225baa5f8bb686824423f50e4427acd3f70d394765bdff32801f0fd5b0' declare -A suitePackageList=() suiteArches=() travisEnv= for version in "${versions[@]}"; do - suite="${debianSuite[$version]}" + tag="${debianSuite[$version]:-$defaultDebianSuite}" + suite="${tag%%-slim}" if [ -z "${suitePackageList["$suite"]:+isset}" ]; then suitePackageList["$suite"]="$(curl -fsSL "${packagesBase}/${suite}-pgdg/main/binary-amd64/Packages.bz2" | bunzip2)" fi @@ -50,6 +48,7 @@ for version in "${versions[@]}"; do cp docker-entrypoint.sh "$version/" sed -e 's/%%PG_MAJOR%%/'"$version"'/g;' \ -e 's/%%PG_VERSION%%/'"$fullVersion"'/g' \ + -e 's/%%DEBIAN_TAG%%/'"$tag"'/g' \ -e 's/%%DEBIAN_SUITE%%/'"$suite"'/g' \ -e 's/%%ARCH_LIST%%/'"${suiteArches["$suite"]}"'/g' \ Dockerfile-debian.template > "$version/Dockerfile"