From 28490a60c628a76a2e5a35b986d687a9dcf3ae0e Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 20 Oct 2017 16:46:19 -0700 Subject: [PATCH 1/2] Update slim variants to use slim Debian variants --- 2.7/jessie/slim/Dockerfile | 2 +- 3.4/jessie/slim/Dockerfile | 2 +- 3.5/jessie/slim/Dockerfile | 2 +- 3.6/jessie/slim/Dockerfile | 2 +- 3.7-rc/stretch/slim/Dockerfile | 2 +- update.sh | 4 ++++ 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/2.7/jessie/slim/Dockerfile b/2.7/jessie/slim/Dockerfile index b49eb3195..9073ae430 100644 --- a/2.7/jessie/slim/Dockerfile +++ b/2.7/jessie/slim/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:jessie +FROM debian:jessie-slim # ensure local python is preferred over distribution python ENV PATH /usr/local/bin:$PATH diff --git a/3.4/jessie/slim/Dockerfile b/3.4/jessie/slim/Dockerfile index 45b78e120..13f55f143 100644 --- a/3.4/jessie/slim/Dockerfile +++ b/3.4/jessie/slim/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:jessie +FROM debian:jessie-slim # ensure local python is preferred over distribution python ENV PATH /usr/local/bin:$PATH diff --git a/3.5/jessie/slim/Dockerfile b/3.5/jessie/slim/Dockerfile index 663e600bb..7db60e2a2 100644 --- a/3.5/jessie/slim/Dockerfile +++ b/3.5/jessie/slim/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:jessie +FROM debian:jessie-slim # ensure local python is preferred over distribution python ENV PATH /usr/local/bin:$PATH diff --git a/3.6/jessie/slim/Dockerfile b/3.6/jessie/slim/Dockerfile index 4960c0cad..4a1ca5e4f 100644 --- a/3.6/jessie/slim/Dockerfile +++ b/3.6/jessie/slim/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:jessie +FROM debian:jessie-slim # ensure local python is preferred over distribution python ENV PATH /usr/local/bin:$PATH diff --git a/3.7-rc/stretch/slim/Dockerfile b/3.7-rc/stretch/slim/Dockerfile index 9fd555611..a997c1149 100644 --- a/3.7-rc/stretch/slim/Dockerfile +++ b/3.7-rc/stretch/slim/Dockerfile @@ -4,7 +4,7 @@ # PLEASE DO NOT EDIT IT DIRECTLY. # -FROM debian:stretch +FROM debian:stretch-slim # ensure local python is preferred over distribution python ENV PATH /usr/local/bin:$PATH diff --git a/update.sh b/update.sh index aecf41bc2..367c2fb0c 100755 --- a/update.sh +++ b/update.sh @@ -111,6 +111,10 @@ for version in "${versions[@]}"; do alpine*) template='alpine'; tag="${variant#alpine}" ;; *) template='debian'; tag="$variant" ;; esac + if [ "$variant" = 'slim' ]; then + # use "debian:*-slim" variants for "python:*-slim" variants + tag+='-slim' + fi template="Dockerfile-${template}.template" if [[ "$version" == 2.* ]]; then From 7891fcc63609dfd43ae2e8de13a40e838b5e7608 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 20 Oct 2017 16:46:34 -0700 Subject: [PATCH 2/2] Add explicit distro to slim variants and slim-stretch variants --- .travis.yml | 2 + 2.7/jessie/slim/Dockerfile | 6 +- 2.7/stretch/slim/Dockerfile | 102 ++++++++++++++++++++++++++++ 3.6/stretch/slim/Dockerfile | 122 ++++++++++++++++++++++++++++++++++ generate-stackbrew-library.sh | 21 ++++-- 5 files changed, 247 insertions(+), 6 deletions(-) create mode 100644 2.7/stretch/slim/Dockerfile create mode 100644 3.6/stretch/slim/Dockerfile diff --git a/.travis.yml b/.travis.yml index e52b81a8d..e1f67631d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ env: - VERSION=3.7-rc VARIANT=stretch/slim - VERSION=3.7-rc VARIANT=alpine3.6 - VERSION=3.6 VARIANT=stretch + - VERSION=3.6 VARIANT=stretch/slim - VERSION=3.6 VARIANT=jessie - VERSION=3.6 VARIANT=jessie/slim - VERSION=3.6 VARIANT=alpine3.6 @@ -18,6 +19,7 @@ env: - VERSION=3.4 VARIANT=wheezy - VERSION=3.4 VARIANT=alpine3.4 - VERSION=2.7 VARIANT=stretch + - VERSION=2.7 VARIANT=stretch/slim - VERSION=2.7 VARIANT=jessie - VERSION=2.7 VARIANT=jessie/slim - VERSION=2.7 VARIANT=wheezy diff --git a/2.7/jessie/slim/Dockerfile b/2.7/jessie/slim/Dockerfile index 9073ae430..111f2eb5e 100644 --- a/2.7/jessie/slim/Dockerfile +++ b/2.7/jessie/slim/Dockerfile @@ -19,7 +19,7 @@ ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF ENV PYTHON_VERSION 2.7.14 RUN set -ex \ - && buildDeps=' \ + && buildDeps=" \ dpkg-dev \ gcc \ libbz2-dev \ @@ -36,7 +36,9 @@ RUN set -ex \ wget \ xz-utils \ zlib1g-dev \ - ' \ +# as of Stretch, "gpg" is no longer included by default + $(command -v gpg > /dev/null || echo 'gnupg2 dirmngr') \ + " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ diff --git a/2.7/stretch/slim/Dockerfile b/2.7/stretch/slim/Dockerfile new file mode 100644 index 000000000..11ce1c065 --- /dev/null +++ b/2.7/stretch/slim/Dockerfile @@ -0,0 +1,102 @@ +FROM debian:stretch-slim + +# ensure local python is preferred over distribution python +ENV PATH /usr/local/bin:$PATH + +# http://bugs.python.org/issue19846 +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. +ENV LANG C.UTF-8 + +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + libgdbm3 \ + libsqlite3-0 \ + libssl1.1 \ + && rm -rf /var/lib/apt/lists/* + +ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF +ENV PYTHON_VERSION 2.7.14 + +RUN set -ex \ + && buildDeps=" \ + dpkg-dev \ + gcc \ + libbz2-dev \ + libc6-dev \ + libdb-dev \ + libgdbm-dev \ + libncurses-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + make \ + tcl-dev \ + tk-dev \ + wget \ + xz-utils \ + zlib1g-dev \ +# as of Stretch, "gpg" is no longer included by default + $(command -v gpg > /dev/null || echo 'gnupg2 dirmngr') \ + " \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + \ + && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ + && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && export GNUPGHOME="$(mktemp -d)" \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ + && rm -rf "$GNUPGHOME" python.tar.xz.asc \ + && mkdir -p /usr/src/python \ + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ + && rm python.tar.xz \ + \ + && cd /usr/src/python \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && ./configure \ + --build="$gnuArch" \ + --enable-shared \ + --enable-unicode=ucs4 \ + && make -j "$(nproc)" \ + && make install \ + && ldconfig \ + \ + && apt-get purge -y --auto-remove $buildDeps \ + \ + && find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' + \ + && rm -rf /usr/src/python + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN set -ex; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends wget; \ + rm -rf /var/lib/apt/lists/*; \ + \ + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ + \ + apt-get purge -y --auto-remove wget; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' +; \ + rm -f get-pip.py + +CMD ["python2"] diff --git a/3.6/stretch/slim/Dockerfile b/3.6/stretch/slim/Dockerfile new file mode 100644 index 000000000..7a6486eb4 --- /dev/null +++ b/3.6/stretch/slim/Dockerfile @@ -0,0 +1,122 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:stretch-slim + +# ensure local python is preferred over distribution python +ENV PATH /usr/local/bin:$PATH + +# http://bugs.python.org/issue19846 +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. +ENV LANG C.UTF-8 + +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + libexpat1 \ + libffi6 \ + libgdbm3 \ + libsqlite3-0 \ + libssl1.1 \ + && rm -rf /var/lib/apt/lists/* + +ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D +ENV PYTHON_VERSION 3.6.3 + +RUN set -ex \ + && buildDeps=" \ + dpkg-dev \ + gcc \ + libbz2-dev \ + libc6-dev \ + libexpat1-dev \ + libffi-dev \ + libgdbm-dev \ + liblzma-dev \ + libncurses-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + make \ + tcl-dev \ + tk-dev \ + wget \ + xz-utils \ + zlib1g-dev \ +# as of Stretch, "gpg" is no longer included by default + $(command -v gpg > /dev/null || echo 'gnupg2 dirmngr') \ + " \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + \ + && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ + && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ + && export GNUPGHOME="$(mktemp -d)" \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ + && rm -rf "$GNUPGHOME" python.tar.xz.asc \ + && mkdir -p /usr/src/python \ + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ + && rm python.tar.xz \ + \ + && cd /usr/src/python \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && ./configure \ + --build="$gnuArch" \ + --enable-loadable-sqlite-extensions \ + --enable-shared \ + --with-system-expat \ + --with-system-ffi \ + --without-ensurepip \ + && make -j "$(nproc)" \ + && make install \ + && ldconfig \ + \ + && apt-get purge -y --auto-remove $buildDeps \ + \ + && find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' + \ + && rm -rf /usr/src/python + +# make some useful symlinks that are expected to exist +RUN cd /usr/local/bin \ + && ln -s idle3 idle \ + && ln -s pydoc3 pydoc \ + && ln -s python3 python \ + && ln -s python3-config python-config + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN set -ex; \ + \ + apt-get update; \ + apt-get install -y --no-install-recommends wget; \ + rm -rf /var/lib/apt/lists/*; \ + \ + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ + \ + apt-get purge -y --auto-remove wget; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a \( -name test -o -name tests \) \) \ + -o \ + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ + \) -exec rm -rf '{}' +; \ + rm -f get-pip.py + +CMD ["python3"] diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 06f6fd819..5a0ffcdc3 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -97,15 +97,23 @@ for version in "${versions[@]}"; do dir="$version/$v" variant="$(basename "$v")" + if [ "$variant" = 'slim' ]; then + # convert "slim" into "slim-jessie" + # https://github.com/docker-library/ruby/pull/142#issuecomment-320012893 + variant="$variant-$(basename "$(dirname "$v")")" + fi + [ -f "$dir/Dockerfile" ] || continue commit="$(dirCommit "$dir")" versionDockerfile="$dir/Dockerfile" + versionCommit="$commit" if [ "$variant" = 'onbuild' ]; then versionDockerfile="$(dirname "$dir")/Dockerfile" + versionCommit="$(dirCommit "$(dirname "$versionDockerfile")")" fi - fullVersion="$(git show "$commit":"$versionDockerfile" | awk '$1 == "ENV" && $2 == "PYTHON_VERSION" { print $3; exit }')" + fullVersion="$(git show "$versionCommit":"$versionDockerfile" | awk '$1 == "ENV" && $2 == "PYTHON_VERSION" { print $3; exit }')" versionAliases=( $fullVersion @@ -114,9 +122,14 @@ for version in "${versions[@]}"; do ) variantAliases=( "${versionAliases[@]/%/-$variant}" ) - if [ "$variant" = "alpine${alpineVersion}" ]; then - variantAliases+=( "${versionAliases[@]/%/-alpine}" ) - fi + case "$variant" in + *-"$debianSuite") # "slim-stretch", etc need "slim" + variantAliases+=( "${versionAliases[@]/%/-${variant%-$debianSuite}}" ) + ;; + "alpine${alpineVersion}") + variantAliases+=( "${versionAliases[@]/%/-alpine}" ) + ;; + esac variantAliases=( "${variantAliases[@]//latest-/}" ) case "$v" in