From b3269e5237f8005944f7199f7247fb97e5e5ce9b Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 8 Aug 2016 13:50:03 -0700 Subject: [PATCH 1/3] Add a few simple Python 3 templates based on existing Dockerfiles --- Dockerfile-alpine.template | 98 +++++++++++++++++++++++++++++++++++++ Dockerfile-debian.template | 73 +++++++++++++++++++++++++++ Dockerfile-onbuild.template | 9 ++++ Dockerfile-slim.template | 86 ++++++++++++++++++++++++++++++++ update.sh | 64 ++++++++++++++++++++++-- 5 files changed, 325 insertions(+), 5 deletions(-) create mode 100644 Dockerfile-alpine.template create mode 100644 Dockerfile-debian.template create mode 100644 Dockerfile-onbuild.template create mode 100644 Dockerfile-slim.template diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template new file mode 100644 index 0000000..22a7bae --- /dev/null +++ b/Dockerfile-alpine.template @@ -0,0 +1,98 @@ +FROM alpine:3.4 + +# 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 + +# install ca-certificates so that HTTPS works consistently +# the other runtime dependencies for Python are installed later +RUN apk add --no-cache ca-certificates + +ENV GPG_KEY %%PLACEHOLDER%% +ENV PYTHON_VERSION %%PLACEHOLDER%% + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% + +RUN set -ex \ + && apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + tar \ + xz \ + \ + && 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 -r "$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 \ + \ + && apk add --no-cache --virtual .build-deps \ + bzip2-dev \ + gcc \ + libc-dev \ + linux-headers \ + make \ + ncurses-dev \ + openssl \ + openssl-dev \ + pax-utils \ + readline-dev \ + sqlite-dev \ + tcl-dev \ + tk \ + tk-dev \ + xz-dev \ + zlib-dev \ +# add build deps before removing fetch deps in case there's overlap + && apk del .fetch-deps \ + \ + && cd /usr/src/python \ + && ./configure \ + --enable-loadable-sqlite-extensions \ + --enable-shared \ + && make -j$(getconf _NPROCESSORS_ONLN) \ + && make install \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_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 '{}' + \ + && runDeps="$( \ + scanelf --needed --nobanner --recursive /usr/local \ + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ + | sort -u \ + | xargs -r apk info --installed \ + | sort -u \ + )" \ + && apk add --virtual .python-rundeps $runDeps \ + && apk del .build-deps \ + && rm -rf /usr/src/python ~/.cache + +# make some useful symlinks that are expected to exist +RUN cd /usr/local/bin \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ + && ln -s idle3 idle \ + && ln -s pydoc3 pydoc \ + && ln -s python3 python \ + && ln -s python3-config python-config + +CMD ["python3"] diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template new file mode 100644 index 0000000..f9df74b --- /dev/null +++ b/Dockerfile-debian.template @@ -0,0 +1,73 @@ +FROM buildpack-deps:jessie + +# 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 \ + tcl \ + tk \ + && rm -rf /var/lib/apt/lists/* + +ENV GPG_KEY %%PLACEHOLDER%% +ENV PYTHON_VERSION %%PLACEHOLDER%% + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% + +RUN set -ex \ + && buildDeps=' \ + tcl-dev \ + tk-dev \ + ' \ + && 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 -r "$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 \ + && ./configure \ + --enable-loadable-sqlite-extensions \ + --enable-shared \ + && make -j$(nproc) \ + && make install \ + && ldconfig \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_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 '{}' + \ + && apt-get purge -y --auto-remove $buildDeps \ + && rm -rf /usr/src/python ~/.cache + +# make some useful symlinks that are expected to exist +RUN cd /usr/local/bin \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ + && ln -s idle3 idle \ + && ln -s pydoc3 pydoc \ + && ln -s python3 python \ + && ln -s python3-config python-config + +CMD ["python3"] diff --git a/Dockerfile-onbuild.template b/Dockerfile-onbuild.template new file mode 100644 index 0000000..2950ec1 --- /dev/null +++ b/Dockerfile-onbuild.template @@ -0,0 +1,9 @@ +FROM python:%%PLACEHOLDER%% + +RUN mkdir -p /usr/src/app +WORKDIR /usr/src/app + +ONBUILD COPY requirements.txt /usr/src/app/ +ONBUILD RUN pip install --no-cache-dir -r requirements.txt + +ONBUILD COPY . /usr/src/app diff --git a/Dockerfile-slim.template b/Dockerfile-slim.template new file mode 100644 index 0000000..c0ac725 --- /dev/null +++ b/Dockerfile-slim.template @@ -0,0 +1,86 @@ +FROM debian:jessie + +# 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 \ + libsqlite3-0 \ + libssl1.0.0 \ + && rm -rf /var/lib/apt/lists/* + +ENV GPG_KEY %%PLACEHOLDER%% +ENV PYTHON_VERSION %%PLACEHOLDER%% + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% + +RUN set -ex \ + && buildDeps=' \ + gcc \ + libbz2-dev \ + libc6-dev \ + liblzma-dev \ + libncurses-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl-dev \ + make \ + tcl-dev \ + tk-dev \ + wget \ + xz-utils \ + zlib1g-dev \ + ' \ + && 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 -r "$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 \ + && ./configure \ + --enable-loadable-sqlite-extensions \ + --enable-shared \ + && make -j$(nproc) \ + && make install \ + && ldconfig \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_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 '{}' + \ + && apt-get purge -y --auto-remove $buildDeps \ + && rm -rf /usr/src/python ~/.cache + +# make some useful symlinks that are expected to exist +RUN cd /usr/local/bin \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ + && ln -s idle3 idle \ + && ln -s pydoc3 pydoc \ + && ln -s python3 python \ + && ln -s python3-config python-config + +CMD ["python3"] diff --git a/update.sh b/update.sh index 937bf37..3a363a6 100755 --- a/update.sh +++ b/update.sh @@ -1,6 +1,28 @@ #!/bin/bash set -e +declare -A gpgKeys=( + # gpg: key 18ADD4FF: public key "Benjamin Peterson " imported + [2.7]='C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF' + # https://www.python.org/dev/peps/pep-0373/#release-manager-and-crew + + # gpg: key 36580288: public key "Georg Brandl (Python release signing key) " imported + [3.3]='26DEA9D4613391EF3E25C9FF0A5B101836580288' + # https://www.python.org/dev/peps/pep-0398/#release-manager-and-crew + + # gpg: key F73C700D: public key "Larry Hastings " imported + [3.4]='97FC712E4C024BBEA48A61ED3A5CA953F73C700D' + # https://www.python.org/dev/peps/pep-0429/#release-manager-and-crew + + # gpg: key F73C700D: public key "Larry Hastings " imported + [3.5]='97FC712E4C024BBEA48A61ED3A5CA953F73C700D' + # https://www.python.org/dev/peps/pep-0478/#release-manager-and-crew + + # gpg: key AA65421D: public key "Ned Deily (Python release signing key) " imported + [3.6]='0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D' + # https://www.python.org/dev/peps/pep-0494/#release-manager-and-crew +) + cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" versions=( "$@" ) @@ -11,6 +33,17 @@ versions=( "${versions[@]%/}" ) pipVersion="$(curl -fsSL 'https://pypi.python.org/pypi/pip/json' | awk -F '"' '$2 == "version" { print $4 }')" +generated_warning() { + cat <<-EOH + # + # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" + # + # PLEASE DO NOT EDIT IT DIRECTLY. + # + + EOH +} + travisEnv= for version in "${versions[@]}"; do # Python 2.7.8 @@ -26,13 +59,34 @@ for version in "${versions[@]}"; do echo } >&2 else + if [[ "$version" != 2.* ]]; then + for variant in \ + debian \ + alpine \ + slim \ + onbuild \ + ; do + if [ "$variant" = 'debian' ]; then + dir="$version" + else + dir="$version/$variant" + fi + template="Dockerfile-$variant.template" + { generated_warning; cat "$template"; } > "$dir/Dockerfile" + done + if [ -d "$version/wheezy" ]; then + cp "$version/Dockerfile" "$version/wheezy/Dockerfile" + sed -ri 's/:jessie/:wheezy/g' "$version/wheezy/Dockerfile" + fi + fi ( set -x - sed -ri ' - s/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/; - s/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/; - ' "$version"/{,*/}Dockerfile - sed -ri 's/^(FROM python):.*/\1:'"$version"'/' "$version/onbuild/Dockerfile" + sed -ri \ + -e 's/^(ENV GPG_KEY) .*/\1 '"${gpgKeys[$version]}"'/' \ + -e 's/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/' \ + -e 's/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/' \ + -e 's/^(FROM python):.*/\1:'"$version"'/' \ + "$version"/{,*/}Dockerfile ) fi for variant in wheezy alpine slim; do From 9a9021f2134d953165b31d98cacb95aa34076f90 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 8 Aug 2016 13:54:15 -0700 Subject: [PATCH 2/3] Apply update.sh (templates) --- 3.3/Dockerfile | 41 ++++++++++++++++++++++++++++------------- 3.3/alpine/Dockerfile | 42 +++++++++++++++++++++++++++++++++--------- 3.3/onbuild/Dockerfile | 6 ++++++ 3.3/slim/Dockerfile | 32 +++++++++++++++++++++++--------- 3.3/wheezy/Dockerfile | 41 ++++++++++++++++++++++++++++------------- 3.4/Dockerfile | 41 ++++++++++++++++++++++++++++------------- 3.4/alpine/Dockerfile | 41 ++++++++++++++++++++++++++++++++--------- 3.4/onbuild/Dockerfile | 6 ++++++ 3.4/slim/Dockerfile | 32 +++++++++++++++++++++++--------- 3.4/wheezy/Dockerfile | 41 ++++++++++++++++++++++++++++------------- 3.5/Dockerfile | 41 ++++++++++++++++++++++++++++------------- 3.5/alpine/Dockerfile | 41 ++++++++++++++++++++++++++++++++--------- 3.5/onbuild/Dockerfile | 6 ++++++ 3.5/slim/Dockerfile | 32 +++++++++++++++++++++++--------- 14 files changed, 324 insertions(+), 119 deletions(-) diff --git a/3.3/Dockerfile b/3.3/Dockerfile index 0ca77a6..c978436 100644 --- a/3.3/Dockerfile +++ b/3.3/Dockerfile @@ -1,15 +1,25 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM buildpack-deps:jessie -# ensure local python is used over debian python +# 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 -# gpg: key 36580288: public key "Georg Brandl (Python release signing key) " imported -ENV GPG_KEY 26DEA9D4613391EF3E25C9FF0A5B101836580288 +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + tcl \ + tk \ + && rm -rf /var/lib/apt/lists/* +ENV GPG_KEY 26DEA9D4613391EF3E25C9FF0A5B101836580288 ENV PYTHON_VERSION 3.3.6 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -20,13 +30,10 @@ RUN set -ex \ tcl-dev \ tk-dev \ ' \ - && runDeps=' \ - tcl \ - tk \ - ' \ - && apt-get update && apt-get install -y $runDeps $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && 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 \ @@ -42,9 +49,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python3 \ - && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -56,6 +70,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.3/alpine/Dockerfile b/3.3/alpine/Dockerfile index 08c419e..b04660e 100644 --- a/3.3/alpine/Dockerfile +++ b/3.3/alpine/Dockerfile @@ -1,5 +1,14 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM alpine:3.4 +# 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 @@ -8,18 +17,21 @@ ENV LANG C.UTF-8 # the other runtime dependencies for Python are installed later RUN apk add --no-cache ca-certificates -# gpg: key 36580288: public key "Georg Brandl (Python release signing key) " imported ENV GPG_KEY 26DEA9D4613391EF3E25C9FF0A5B101836580288 - ENV PYTHON_VERSION 3.3.6 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps curl gnupg tar xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + tar \ + xz \ + \ + && 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 \ @@ -35,6 +47,7 @@ RUN set -ex \ linux-headers \ make \ ncurses-dev \ + openssl \ openssl-dev \ pax-utils \ readline-dev \ @@ -44,15 +57,25 @@ RUN set -ex \ tk-dev \ xz-dev \ zlib-dev \ +# add build deps before removing fetch deps in case there's overlap + && apk del .fetch-deps \ + \ && cd /usr/src/python \ && ./configure \ --enable-loadable-sqlite-extensions \ --enable-shared \ && make -j$(getconf _NPROCESSORS_ONLN) \ && make install \ - && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python3 \ - && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -67,11 +90,12 @@ RUN set -ex \ | sort -u \ )" \ && apk add --virtual .python-rundeps $runDeps \ - && apk del .build-deps .fetch-deps \ + && apk del .build-deps \ && rm -rf /usr/src/python ~/.cache # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.3/onbuild/Dockerfile b/3.3/onbuild/Dockerfile index b200ef8..bc96d2f 100644 --- a/3.3/onbuild/Dockerfile +++ b/3.3/onbuild/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM python:3.3 RUN mkdir -p /usr/src/app diff --git a/3.3/slim/Dockerfile b/3.3/slim/Dockerfile index 030cff5..a12e09c 100644 --- a/3.3/slim/Dockerfile +++ b/3.3/slim/Dockerfile @@ -1,21 +1,26 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:jessie -# ensure local python is used over debian python +# 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 \ libsqlite3-0 \ libssl1.0.0 \ && rm -rf /var/lib/apt/lists/* -# gpg: key 36580288: public key "Georg Brandl (Python release signing key) " imported ENV GPG_KEY 26DEA9D4613391EF3E25C9FF0A5B101836580288 - ENV PYTHON_VERSION 3.3.6 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -23,7 +28,6 @@ ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ @@ -35,12 +39,14 @@ RUN set -ex \ make \ tcl-dev \ tk-dev \ + wget \ xz-utils \ zlib1g-dev \ ' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + \ + && 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 \ @@ -56,9 +62,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python3 \ - && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -70,6 +83,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.3/wheezy/Dockerfile b/3.3/wheezy/Dockerfile index 0f1787e..ef0c415 100644 --- a/3.3/wheezy/Dockerfile +++ b/3.3/wheezy/Dockerfile @@ -1,15 +1,25 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM buildpack-deps:wheezy -# ensure local python is used over debian python +# 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 -# gpg: key 36580288: public key "Georg Brandl (Python release signing key) " imported -ENV GPG_KEY 26DEA9D4613391EF3E25C9FF0A5B101836580288 +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + tcl \ + tk \ + && rm -rf /var/lib/apt/lists/* +ENV GPG_KEY 26DEA9D4613391EF3E25C9FF0A5B101836580288 ENV PYTHON_VERSION 3.3.6 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -20,13 +30,10 @@ RUN set -ex \ tcl-dev \ tk-dev \ ' \ - && runDeps=' \ - tcl \ - tk \ - ' \ - && apt-get update && apt-get install -y $runDeps $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && 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 \ @@ -42,9 +49,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python3 \ - && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -56,6 +70,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.4/Dockerfile b/3.4/Dockerfile index e66500d..c42717b 100644 --- a/3.4/Dockerfile +++ b/3.4/Dockerfile @@ -1,15 +1,25 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM buildpack-deps:jessie -# ensure local python is used over debian python +# 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 -# gpg: key F73C700D: public key "Larry Hastings " imported -ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + tcl \ + tk \ + && rm -rf /var/lib/apt/lists/* +ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D ENV PYTHON_VERSION 3.4.5 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -20,13 +30,10 @@ RUN set -ex \ tcl-dev \ tk-dev \ ' \ - && runDeps=' \ - tcl \ - tk \ - ' \ - && apt-get update && apt-get install -y $runDeps $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && 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 \ @@ -42,8 +49,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -55,7 +70,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.4 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.4/alpine/Dockerfile b/3.4/alpine/Dockerfile index f00d787..19dc70c 100644 --- a/3.4/alpine/Dockerfile +++ b/3.4/alpine/Dockerfile @@ -1,5 +1,14 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM alpine:3.4 +# 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 @@ -8,18 +17,21 @@ ENV LANG C.UTF-8 # the other runtime dependencies for Python are installed later RUN apk add --no-cache ca-certificates -# gpg: key F73C700D: public key "Larry Hastings " imported ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D - ENV PYTHON_VERSION 3.4.5 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps curl gnupg tar xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + tar \ + xz \ + \ + && 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 \ @@ -27,7 +39,6 @@ RUN set -ex \ && mkdir -p /usr/src/python \ && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ && rm python.tar.xz \ - && apk del .fetch-deps \ \ && apk add --no-cache --virtual .build-deps \ bzip2-dev \ @@ -36,6 +47,7 @@ RUN set -ex \ linux-headers \ make \ ncurses-dev \ + openssl \ openssl-dev \ pax-utils \ readline-dev \ @@ -45,14 +57,25 @@ RUN set -ex \ tk-dev \ xz-dev \ zlib-dev \ +# add build deps before removing fetch deps in case there's overlap + && apk del .fetch-deps \ + \ && cd /usr/src/python \ && ./configure \ --enable-loadable-sqlite-extensions \ --enable-shared \ && make -j$(getconf _NPROCESSORS_ONLN) \ && make install \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -72,7 +95,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.4 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.4/onbuild/Dockerfile b/3.4/onbuild/Dockerfile index f0d0172..892c9c3 100644 --- a/3.4/onbuild/Dockerfile +++ b/3.4/onbuild/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM python:3.4 RUN mkdir -p /usr/src/app diff --git a/3.4/slim/Dockerfile b/3.4/slim/Dockerfile index 17adf61..89699fd 100644 --- a/3.4/slim/Dockerfile +++ b/3.4/slim/Dockerfile @@ -1,21 +1,26 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:jessie -# ensure local python is used over debian python +# 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 \ libsqlite3-0 \ libssl1.0.0 \ && rm -rf /var/lib/apt/lists/* -# gpg: key F73C700D: public key "Larry Hastings " imported ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D - ENV PYTHON_VERSION 3.4.5 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -23,7 +28,6 @@ ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ @@ -35,12 +39,14 @@ RUN set -ex \ make \ tcl-dev \ tk-dev \ + wget \ xz-utils \ zlib1g-dev \ ' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + \ + && 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 \ @@ -56,8 +62,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -69,7 +83,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.4 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.4/wheezy/Dockerfile b/3.4/wheezy/Dockerfile index 9d52bc8..72eb6bd 100644 --- a/3.4/wheezy/Dockerfile +++ b/3.4/wheezy/Dockerfile @@ -1,15 +1,25 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM buildpack-deps:wheezy -# ensure local python is used over debian python +# 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 -# gpg: key F73C700D: public key "Larry Hastings " imported -ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + tcl \ + tk \ + && rm -rf /var/lib/apt/lists/* +ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D ENV PYTHON_VERSION 3.4.5 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -20,13 +30,10 @@ RUN set -ex \ tcl-dev \ tk-dev \ ' \ - && runDeps=' \ - tcl \ - tk \ - ' \ - && apt-get update && apt-get install -y $runDeps $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && 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 \ @@ -42,8 +49,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -55,7 +70,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.4 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.5/Dockerfile b/3.5/Dockerfile index a52b158..b9aa4ce 100644 --- a/3.5/Dockerfile +++ b/3.5/Dockerfile @@ -1,15 +1,25 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM buildpack-deps:jessie -# ensure local python is used over debian python +# 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 -# gpg: key F73C700D: public key "Larry Hastings " imported -ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + tcl \ + tk \ + && rm -rf /var/lib/apt/lists/* +ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D ENV PYTHON_VERSION 3.5.2 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -20,13 +30,10 @@ RUN set -ex \ tcl-dev \ tk-dev \ ' \ - && runDeps=' \ - tcl \ - tk \ - ' \ - && apt-get update && apt-get install -y $runDeps $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && 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 \ @@ -42,8 +49,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -55,7 +70,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.5 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.5/alpine/Dockerfile b/3.5/alpine/Dockerfile index f21e0b7..d368cbb 100644 --- a/3.5/alpine/Dockerfile +++ b/3.5/alpine/Dockerfile @@ -1,5 +1,14 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM alpine:3.4 +# 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 @@ -8,18 +17,21 @@ ENV LANG C.UTF-8 # the other runtime dependencies for Python are installed later RUN apk add --no-cache ca-certificates -# gpg: key F73C700D: public key "Larry Hastings " imported ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D - ENV PYTHON_VERSION 3.5.2 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps curl gnupg tar xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + tar \ + xz \ + \ + && 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 \ @@ -27,7 +39,6 @@ RUN set -ex \ && mkdir -p /usr/src/python \ && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ && rm python.tar.xz \ - && apk del .fetch-deps \ \ && apk add --no-cache --virtual .build-deps \ bzip2-dev \ @@ -36,6 +47,7 @@ RUN set -ex \ linux-headers \ make \ ncurses-dev \ + openssl \ openssl-dev \ pax-utils \ readline-dev \ @@ -45,14 +57,25 @@ RUN set -ex \ tk-dev \ xz-dev \ zlib-dev \ +# add build deps before removing fetch deps in case there's overlap + && apk del .fetch-deps \ + \ && cd /usr/src/python \ && ./configure \ --enable-loadable-sqlite-extensions \ --enable-shared \ && make -j$(getconf _NPROCESSORS_ONLN) \ && make install \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -72,7 +95,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.5 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.5/onbuild/Dockerfile b/3.5/onbuild/Dockerfile index 536d848..45b1f2a 100644 --- a/3.5/onbuild/Dockerfile +++ b/3.5/onbuild/Dockerfile @@ -1,3 +1,9 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM python:3.5 RUN mkdir -p /usr/src/app diff --git a/3.5/slim/Dockerfile b/3.5/slim/Dockerfile index 4a5ed56..d981a6a 100644 --- a/3.5/slim/Dockerfile +++ b/3.5/slim/Dockerfile @@ -1,21 +1,26 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM debian:jessie -# ensure local python is used over debian python +# 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 \ libsqlite3-0 \ libssl1.0.0 \ && rm -rf /var/lib/apt/lists/* -# gpg: key F73C700D: public key "Larry Hastings " imported ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D - ENV PYTHON_VERSION 3.5.2 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -23,7 +28,6 @@ ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ @@ -35,12 +39,14 @@ RUN set -ex \ make \ tcl-dev \ tk-dev \ + wget \ xz-utils \ zlib1g-dev \ ' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + \ + && 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 \ @@ -56,8 +62,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -69,7 +83,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.5 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ From f1bc9f790605ecf0dabce4c24ef9ee5ce205e496 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 8 Aug 2016 13:50:24 -0700 Subject: [PATCH 3/3] Apply template to python:2.7 and python:3.6 which don't currently get the templates applied directly --- 2.7/Dockerfile | 31 ++++++++++++++++++------------- 2.7/alpine/Dockerfile | 32 +++++++++++++++++++++++--------- 2.7/slim/Dockerfile | 22 +++++++++++++--------- 2.7/wheezy/Dockerfile | 31 ++++++++++++++++++------------- 3.6/Dockerfile | 35 ++++++++++++++++++++++------------- 3.6/alpine/Dockerfile | 35 ++++++++++++++++++++++++++--------- 3.6/slim/Dockerfile | 26 +++++++++++++++++--------- 7 files changed, 137 insertions(+), 75 deletions(-) diff --git a/2.7/Dockerfile b/2.7/Dockerfile index ea1dc08..2ca772a 100644 --- a/2.7/Dockerfile +++ b/2.7/Dockerfile @@ -1,15 +1,19 @@ FROM buildpack-deps:jessie -# ensure local python is used over debian python +# 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 -# gpg: key 18ADD4FF: public key "Benjamin Peterson " imported -ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + tcl \ + tk \ + && rm -rf /var/lib/apt/lists/* +ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF ENV PYTHON_VERSION 2.7.12 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -20,13 +24,10 @@ RUN set -ex \ tcl-dev \ tk-dev \ ' \ - && runDeps=' \ - tcl \ - tk \ - ' \ - && apt-get update && apt-get install -y $runDeps $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && 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 \ @@ -42,9 +43,13 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ - && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + && pip install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ diff --git a/2.7/alpine/Dockerfile b/2.7/alpine/Dockerfile index ff36e0f..dd70b8c 100644 --- a/2.7/alpine/Dockerfile +++ b/2.7/alpine/Dockerfile @@ -1,5 +1,8 @@ FROM alpine:3.4 +# 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 @@ -8,18 +11,21 @@ ENV LANG C.UTF-8 # the other runtime dependencies for Python are installed later RUN apk add --no-cache ca-certificates -# gpg: key 18ADD4FF: public key "Benjamin Peterson " imported ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF - ENV PYTHON_VERSION 2.7.12 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps curl gnupg tar xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + tar \ + xz \ + \ + && 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 \ @@ -35,6 +41,7 @@ RUN set -ex \ linux-headers \ make \ ncurses-dev \ + openssl \ openssl-dev \ pax-utils \ readline-dev \ @@ -43,15 +50,22 @@ RUN set -ex \ tk \ tk-dev \ zlib-dev \ +# add build deps before removing fetch deps in case there's overlap + && apk del .fetch-deps \ + \ && cd /usr/src/python \ && ./configure \ --enable-shared \ --enable-unicode=ucs4 \ && make -j$(getconf _NPROCESSORS_ONLN) \ && make install \ - && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ - && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + && pip install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -66,7 +80,7 @@ RUN set -ex \ | sort -u \ )" \ && apk add --virtual .python-rundeps $runDeps \ - && apk del .build-deps .fetch-deps \ + && apk del .build-deps \ && rm -rf /usr/src/python ~/.cache CMD ["python2"] diff --git a/2.7/slim/Dockerfile b/2.7/slim/Dockerfile index ee7b1cd..821a3d5 100644 --- a/2.7/slim/Dockerfile +++ b/2.7/slim/Dockerfile @@ -1,21 +1,20 @@ FROM debian:jessie -# ensure local python is used over debian python +# 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 \ libsqlite3-0 \ libssl1.0.0 \ && rm -rf /var/lib/apt/lists/* -# gpg: key 18ADD4FF: public key "Benjamin Peterson " imported ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF - ENV PYTHON_VERSION 2.7.12 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -23,7 +22,6 @@ ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ @@ -34,12 +32,14 @@ RUN set -ex \ make \ tcl-dev \ tk-dev \ + wget \ xz-utils \ zlib1g-dev \ ' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + \ + && 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 \ @@ -55,9 +55,13 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ - && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + && pip install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ diff --git a/2.7/wheezy/Dockerfile b/2.7/wheezy/Dockerfile index e68c736..ac5182b 100644 --- a/2.7/wheezy/Dockerfile +++ b/2.7/wheezy/Dockerfile @@ -1,15 +1,19 @@ FROM buildpack-deps:wheezy -# ensure local python is used over debian python +# 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 -# gpg: key 18ADD4FF: public key "Benjamin Peterson " imported -ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + tcl \ + tk \ + && rm -rf /var/lib/apt/lists/* +ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF ENV PYTHON_VERSION 2.7.12 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -20,13 +24,10 @@ RUN set -ex \ tcl-dev \ tk-dev \ ' \ - && runDeps=' \ - tcl \ - tk \ - ' \ - && apt-get update && apt-get install -y $runDeps $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && 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 \ @@ -42,9 +43,13 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ - && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + && pip install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ diff --git a/3.6/Dockerfile b/3.6/Dockerfile index 7652dc6..fff6d77 100644 --- a/3.6/Dockerfile +++ b/3.6/Dockerfile @@ -1,15 +1,19 @@ FROM buildpack-deps:jessie -# ensure local python is used over debian python +# 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 -# gpg: key AA65421D: public key "Ned Deily (Python release signing key) " imported -ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D +# runtime dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + tcl \ + tk \ + && rm -rf /var/lib/apt/lists/* +ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.6.0a3 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -20,13 +24,10 @@ RUN set -ex \ tcl-dev \ tk-dev \ ' \ - && runDeps=' \ - tcl \ - tk \ - ' \ - && apt-get update && apt-get install -y $runDeps $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && 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 \ @@ -42,8 +43,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -55,7 +64,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.6 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.6/alpine/Dockerfile b/3.6/alpine/Dockerfile index 03a13bd..96bedb9 100644 --- a/3.6/alpine/Dockerfile +++ b/3.6/alpine/Dockerfile @@ -1,5 +1,8 @@ FROM alpine:3.4 +# 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 @@ -8,18 +11,21 @@ ENV LANG C.UTF-8 # the other runtime dependencies for Python are installed later RUN apk add --no-cache ca-certificates -# gpg: key AA65421D: public key "Ned Deily (Python release signing key) " imported ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D - ENV PYTHON_VERSION 3.6.0a3 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ - && apk add --no-cache --virtual .fetch-deps curl gnupg tar xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + && apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + tar \ + xz \ + \ + && 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 \ @@ -27,7 +33,6 @@ RUN set -ex \ && mkdir -p /usr/src/python \ && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ && rm python.tar.xz \ - && apk del .fetch-deps \ \ && apk add --no-cache --virtual .build-deps \ bzip2-dev \ @@ -36,6 +41,7 @@ RUN set -ex \ linux-headers \ make \ ncurses-dev \ + openssl \ openssl-dev \ pax-utils \ readline-dev \ @@ -45,14 +51,25 @@ RUN set -ex \ tk-dev \ xz-dev \ zlib-dev \ +# add build deps before removing fetch deps in case there's overlap + && apk del .fetch-deps \ + \ && cd /usr/src/python \ && ./configure \ --enable-loadable-sqlite-extensions \ --enable-shared \ && make -j$(getconf _NPROCESSORS_ONLN) \ && make install \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -72,7 +89,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.6 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ diff --git a/3.6/slim/Dockerfile b/3.6/slim/Dockerfile index 5ceb89d..75dbc91 100644 --- a/3.6/slim/Dockerfile +++ b/3.6/slim/Dockerfile @@ -1,21 +1,20 @@ FROM debian:jessie -# ensure local python is used over debian python +# 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 \ libsqlite3-0 \ libssl1.0.0 \ && rm -rf /var/lib/apt/lists/* -# gpg: key AA65421D: public key "Ned Deily (Python release signing key) " imported ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D - ENV PYTHON_VERSION 3.6.0a3 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" @@ -23,7 +22,6 @@ ENV PYTHON_PIP_VERSION 8.1.2 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ @@ -35,12 +33,14 @@ RUN set -ex \ make \ tcl-dev \ tk-dev \ + wget \ xz-utils \ zlib1g-dev \ ' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ - && curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ + \ + && 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 \ @@ -56,8 +56,16 @@ RUN set -ex \ && make -j$(nproc) \ && make install \ && ldconfig \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ +# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere + && if [ ! -e /usr/local/bin/pip3 ]; then : \ + && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ + && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ + && rm /tmp/get-pip.py \ + ; fi \ + && pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \ + && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + \ && find /usr/local -depth \ \( \ \( -type d -a -name test -o -name tests \) \ @@ -69,7 +77,7 @@ RUN set -ex \ # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && ln -s easy_install-3.6 easy_install \ + && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \