diff --git a/.travis.yml b/.travis.yml index 24b2e11b1..ded932948 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,9 @@ language: bash services: docker env: - - VERSION=3.6 VARIANT= - - VERSION=3.6 VARIANT=slim - - VERSION=3.6 VARIANT=alpine + - VERSION=3.6-rc VARIANT= + - VERSION=3.6-rc VARIANT=slim + - VERSION=3.6-rc VARIANT=alpine - VERSION=3.5 VARIANT= - VERSION=3.5 VARIANT=slim - VERSION=3.5 VARIANT=alpine diff --git a/2.7/Dockerfile b/2.7/Dockerfile index 67d4881c1..f39acf108 100644 --- a/2.7/Dockerfile +++ b/2.7/Dockerfile @@ -1,44 +1,34 @@ -FROM buildpack-deps:jessie +FROM quay.io/wantedly/buildpack-deps:14.04 -# divert many traces of Debian Python (so that they are not used by mistake) -# https://bugs.debian.org/33263 :( -RUN set -ex \ - && for bits in \ -# /etc/python* \ - /usr/bin/*2to3* \ - /usr/bin/*python* \ - /usr/bin/pdb* \ - /usr/bin/py* \ -# /usr/lib/python* \ -# /usr/share/python \ - ; do \ - dpkg-divert --rename "$bits"; \ - done +# 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 PYTHON_VERSION 2.7.12 +ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF +ENV PYTHON_VERSION 2.7.13 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ tcl-dev \ tk-dev \ + wget \ ' \ - && 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 \ @@ -53,14 +43,23 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 diff --git a/2.7/alpine/Dockerfile b/2.7/alpine/Dockerfile index 056c49283..fe299aa02 100644 --- a/2.7/alpine/Dockerfile +++ b/2.7/alpine/Dockerfile @@ -1,21 +1,31 @@ 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 -# gpg: key 18ADD4FF: public key "Benjamin Peterson " imported -ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF +# 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 PYTHON_VERSION 2.7.12 +ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF +ENV PYTHON_VERSION 2.7.13 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 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,10 +37,12 @@ RUN set -ex \ && apk add --no-cache --virtual .build-deps \ bzip2-dev \ gcc \ + gdbm-dev \ libc-dev \ linux-headers \ make \ ncurses-dev \ + openssl \ openssl-dev \ pax-utils \ readline-dev \ @@ -39,20 +51,32 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ @@ -62,7 +86,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/narrow/Dockerfile b/2.7/narrow/Dockerfile new file mode 100644 index 000000000..e068e8a45 --- /dev/null +++ b/2.7/narrow/Dockerfile @@ -0,0 +1,70 @@ +FROM quay.io/wantedly/buildpack-deps:14.04 + +# 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 C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF +ENV PYTHON_VERSION 2.7.13 + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN set -ex \ + && buildDeps=' \ + tcl-dev \ + tk-dev \ + wget \ + ' \ + && 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-unicode=ucs2 \ + && make -j$(nproc) \ + && make install \ + && ldconfig \ + \ + && 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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 + +# install "virtualenv", since the vast majority of users of this image will want it +RUN pip install --no-cache-dir virtualenv + +CMD ["python2"] diff --git a/2.7/slim/Dockerfile b/2.7/slim/Dockerfile index 7a72af34c..fa8a55d60 100644 --- a/2.7/slim/Dockerfile +++ b/2.7/slim/Dockerfile @@ -1,29 +1,33 @@ 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 \ + libgdbm3 \ 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 +ENV PYTHON_VERSION 2.7.13 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ + libdb-dev \ + libgdbm-dev \ libncurses-dev \ libreadline-dev \ libsqlite3-dev \ @@ -31,12 +35,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 \ @@ -52,14 +58,23 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 diff --git a/2.7/wheezy/Dockerfile b/2.7/wheezy/Dockerfile index 9731b10b1..b14b748a0 100644 --- a/2.7/wheezy/Dockerfile +++ b/2.7/wheezy/Dockerfile @@ -1,44 +1,33 @@ FROM buildpack-deps:wheezy -# divert many traces of Debian Python (so that they are not used by mistake) -# https://bugs.debian.org/33263 :( -RUN set -ex \ - && for bits in \ -# /etc/python* \ - /usr/bin/*2to3* \ - /usr/bin/*python* \ - /usr/bin/pdb* \ - /usr/bin/py* \ -# /usr/lib/python* \ -# /usr/share/python \ - ; do \ - dpkg-divert --rename "$bits"; \ - done +# 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 PYTHON_VERSION 2.7.12 +ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF +ENV PYTHON_VERSION 2.7.13 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ 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 \ @@ -54,14 +43,23 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 diff --git a/2.7/windows/windowsservercore/Dockerfile b/2.7/windows/windowsservercore/Dockerfile new file mode 100644 index 000000000..4d89c2379 --- /dev/null +++ b/2.7/windows/windowsservercore/Dockerfile @@ -0,0 +1,51 @@ +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV PYTHON_VERSION 2.7.13 +ENV PYTHON_RELEASE 2.7.13 + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}.amd64.msi' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ + Write-Host ('Downloading {0} ...' -f $url); \ + (New-Object System.Net.WebClient).DownloadFile($url, 'python.msi'); \ + \ + Write-Host 'Installing ...'; \ +# https://www.python.org/download/releases/2.4/msi/ + Start-Process msiexec -Wait \ + -ArgumentList @( \ + '/i', \ + 'python.msi', \ + '/quiet', \ + '/qn', \ + 'TARGETDIR=C:\Python', \ + 'ALLUSERS=1', \ + 'ADDLOCAL=DefaultFeature,Extensions,TclTk,Tools,PrependPath' \ + ); \ + \ +# the installer updated PATH, so we should refresh our local value + $env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ...'; \ + Write-Host ' python --version'; python --version; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item python.msi -Force; \ + \ + $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \ + Write-Host ('Installing {0} ...' -f $pipInstall); \ + (New-Object System.Net.WebClient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'get-pip.py'); \ + python get-pip.py $pipInstall; \ + Remove-Item get-pip.py -Force; \ + \ + Write-Host 'Verifying pip install ...'; \ + pip --version; \ + \ + Write-Host 'Complete.'; + +# install "virtualenv", since the vast majority of users of this image will want it +RUN pip install --no-cache-dir virtualenv + +CMD ["python"] diff --git a/3.3/Dockerfile b/3.3/Dockerfile index 3ef68f81e..7ba4ef985 100644 --- a/3.3/Dockerfile +++ b/3.3/Dockerfile @@ -1,44 +1,40 @@ -FROM buildpack-deps:jessie +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# -# divert many traces of Debian Python (so that they are not used by mistake) -# https://bugs.debian.org/33263 :( -RUN set -ex \ - && for bits in \ -# /etc/python* \ - /usr/bin/*2to3* \ - /usr/bin/*python* \ - /usr/bin/pdb* \ - /usr/bin/py* \ -# /usr/lib/python* \ -# /usr/share/python \ - ; do \ - dpkg-divert --rename "$bits"; \ - done +FROM quay.io/wantedly/buildpack-deps:14.04 + +# 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 ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ tcl-dev \ tk-dev \ + wget \ ' \ - && 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 \ @@ -54,20 +50,33 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ diff --git a/3.3/alpine/Dockerfile b/3.3/alpine/Dockerfile index e7d5d1fd7..042ae7ce4 100644 --- a/3.3/alpine/Dockerfile +++ b/3.3/alpine/Dockerfile @@ -1,21 +1,37 @@ +# +# 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 -# gpg: key 36580288: public key "Georg Brandl (Python release signing key) " imported -ENV GPG_KEY 26DEA9D4613391EF3E25C9FF0A5B101836580288 +# 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 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 +ENV PYTHON_PIP_VERSION 9.0.1 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,10 +43,12 @@ RUN set -ex \ && apk add --no-cache --virtual .build-deps \ bzip2-dev \ gcc \ + gdbm-dev \ libc-dev \ linux-headers \ make \ ncurses-dev \ + openssl \ openssl-dev \ pax-utils \ readline-dev \ @@ -40,20 +58,35 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ @@ -63,11 +96,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 b200ef8e3..bc96d2fc7 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 f54ea740b..648b8abbe 100644 --- a/3.3/slim/Dockerfile +++ b/3.3/slim/Dockerfile @@ -1,29 +1,38 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + 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 \ + libgdbm3 \ 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 ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ + libgdbm-dev \ liblzma-dev \ libncurses-dev \ libreadline-dev \ @@ -32,12 +41,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 \ @@ -53,20 +64,33 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ diff --git a/3.3/wheezy/Dockerfile b/3.3/wheezy/Dockerfile index 45e63bc11..580513e7d 100644 --- a/3.3/wheezy/Dockerfile +++ b/3.3/wheezy/Dockerfile @@ -1,44 +1,39 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM buildpack-deps:wheezy -# divert many traces of Debian Python (so that they are not used by mistake) -# https://bugs.debian.org/33263 :( -RUN set -ex \ - && for bits in \ -# /etc/python* \ - /usr/bin/*2to3* \ - /usr/bin/*python* \ - /usr/bin/pdb* \ - /usr/bin/py* \ -# /usr/lib/python* \ -# /usr/share/python \ - ; do \ - dpkg-divert --rename "$bits"; \ - done +# 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 ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ 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 \ @@ -54,20 +49,33 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ diff --git a/3.4/Dockerfile b/3.4/Dockerfile index 121e4a518..48b5caf7b 100644 --- a/3.4/Dockerfile +++ b/3.4/Dockerfile @@ -1,44 +1,40 @@ -FROM buildpack-deps:jessie +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# -# divert many traces of Debian Python (so that they are not used by mistake) -# https://bugs.debian.org/33263 :( -RUN set -ex \ - && for bits in \ -# /etc/python* \ - /usr/bin/*2to3* \ - /usr/bin/*python* \ - /usr/bin/pdb* \ - /usr/bin/py* \ -# /usr/lib/python* \ -# /usr/share/python \ - ; do \ - dpkg-divert --rename "$bits"; \ - done +FROM quay.io/wantedly/buildpack-deps:14.04 + +# 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 ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ tcl-dev \ tk-dev \ + wget \ ' \ - && 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 \ @@ -50,24 +46,36 @@ RUN set -ex \ && cd /usr/src/python \ && ./configure \ --enable-loadable-sqlite-extensions \ - --enable-shared \ && 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ - && 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 57b9f784a..4f6629ef7 100644 --- a/3.4/alpine/Dockerfile +++ b/3.4/alpine/Dockerfile @@ -1,21 +1,37 @@ +# +# 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 -# gpg: key F73C700D: public key "Larry Hastings " imported -ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D +# 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 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 +ENV PYTHON_PIP_VERSION 9.0.1 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 \ @@ -23,15 +39,16 @@ 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 \ gcc \ + gdbm-dev \ libc-dev \ linux-headers \ make \ ncurses-dev \ + openssl \ openssl-dev \ pax-utils \ readline-dev \ @@ -41,19 +58,35 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ @@ -68,7 +101,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 f0d01721c..892c9c321 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 b25f47d12..d08ff9833 100644 --- a/3.4/slim/Dockerfile +++ b/3.4/slim/Dockerfile @@ -1,29 +1,38 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + 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 \ + libgdbm3 \ 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 ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ + libgdbm-dev \ liblzma-dev \ libncurses-dev \ libreadline-dev \ @@ -32,12 +41,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 \ @@ -53,20 +64,33 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ - && 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 959aaccac..6aeb45f38 100644 --- a/3.4/wheezy/Dockerfile +++ b/3.4/wheezy/Dockerfile @@ -1,44 +1,39 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + FROM buildpack-deps:wheezy -# divert many traces of Debian Python (so that they are not used by mistake) -# https://bugs.debian.org/33263 :( -RUN set -ex \ - && for bits in \ -# /etc/python* \ - /usr/bin/*2to3* \ - /usr/bin/*python* \ - /usr/bin/pdb* \ - /usr/bin/py* \ -# /usr/lib/python* \ -# /usr/share/python \ - ; do \ - dpkg-divert --rename "$bits"; \ - done +# 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 ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ 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 \ @@ -54,20 +49,33 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ - && 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 f3971ecf9..28c3d9f90 100644 --- a/3.5/Dockerfile +++ b/3.5/Dockerfile @@ -1,44 +1,40 @@ -FROM buildpack-deps:jessie +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# -# divert many traces of Debian Python (so that they are not used by mistake) -# https://bugs.debian.org/33263 :( -RUN set -ex \ - && for bits in \ -# /etc/python* \ - /usr/bin/*2to3* \ - /usr/bin/*python* \ - /usr/bin/pdb* \ - /usr/bin/py* \ -# /usr/lib/python* \ -# /usr/share/python \ - ; do \ - dpkg-divert --rename "$bits"; \ - done +FROM quay.io/wantedly/buildpack-deps:14.04 + +# 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 ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ tcl-dev \ tk-dev \ + wget \ ' \ - && 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 \ @@ -50,24 +46,36 @@ RUN set -ex \ && cd /usr/src/python \ && ./configure \ --enable-loadable-sqlite-extensions \ - --enable-shared \ && 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ - && 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 ccae08c80..d71bbf9f2 100644 --- a/3.5/alpine/Dockerfile +++ b/3.5/alpine/Dockerfile @@ -1,21 +1,37 @@ +# +# 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 -# gpg: key F73C700D: public key "Larry Hastings " imported -ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D +# 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 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 +ENV PYTHON_PIP_VERSION 9.0.1 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 \ @@ -23,15 +39,16 @@ 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 \ gcc \ + gdbm-dev \ libc-dev \ linux-headers \ make \ ncurses-dev \ + openssl \ openssl-dev \ pax-utils \ readline-dev \ @@ -41,19 +58,35 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ @@ -68,7 +101,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 536d84822..45b1f2a39 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 2ff34f07e..328bd9f53 100644 --- a/3.5/slim/Dockerfile +++ b/3.5/slim/Dockerfile @@ -1,29 +1,38 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + 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 \ + libgdbm3 \ 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 ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ + libgdbm-dev \ liblzma-dev \ libncurses-dev \ libreadline-dev \ @@ -32,12 +41,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 \ @@ -53,20 +64,33 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ - && 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/windows/windowsservercore/Dockerfile b/3.5/windows/windowsservercore/Dockerfile new file mode 100644 index 000000000..b218d0f3b --- /dev/null +++ b/3.5/windows/windowsservercore/Dockerfile @@ -0,0 +1,55 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV PYTHON_VERSION 3.5.2 +ENV PYTHON_RELEASE 3.5.2 + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ + Write-Host ('Downloading {0} ...' -f $url); \ + (New-Object System.Net.WebClient).DownloadFile($url, 'python.exe'); \ + \ + Write-Host 'Installing ...'; \ +# https://docs.python.org/3.5/using/windows.html#installing-without-ui + Start-Process python.exe -Wait \ + -ArgumentList @( \ + '/quiet', \ + 'InstallAllUsers=1', \ + 'TargetDir=C:\Python', \ + 'PrependPath=1', \ + 'Shortcuts=0', \ + 'Include_doc=0', \ + 'Include_test=0' \ + ); \ + \ +# the installer updated PATH, so we should refresh our local value + $env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ...'; \ + Write-Host ' python --version'; python --version; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item python.exe -Force; \ + \ + $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \ + Write-Host ('Installing {0} ...' -f $pipInstall); \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + pip install --no-cache-dir --upgrade --force-reinstall $pipInstall; \ + \ + Write-Host 'Verifying pip install ...'; \ + pip --version; \ + \ + Write-Host 'Complete.'; + +CMD ["python"] diff --git a/3.6-rc/Dockerfile b/3.6-rc/Dockerfile new file mode 100644 index 000000000..50f0bf306 --- /dev/null +++ b/3.6-rc/Dockerfile @@ -0,0 +1,85 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM quay.io/wantedly/buildpack-deps:14.04 + +# 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 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D +ENV PYTHON_VERSION 3.6.0 + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN set -ex \ + && buildDeps=' \ + tcl-dev \ + tk-dev \ + wget \ + ' \ + && 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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/3.6-rc/alpine/Dockerfile b/3.6-rc/alpine/Dockerfile new file mode 100644 index 000000000..1f623374c --- /dev/null +++ b/3.6-rc/alpine/Dockerfile @@ -0,0 +1,110 @@ +# +# 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 + +# 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 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D +ENV PYTHON_VERSION 3.6.0rc2 + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +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 \ + gdbm-dev \ + 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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/3.6-rc/onbuild/Dockerfile b/3.6-rc/onbuild/Dockerfile new file mode 100644 index 000000000..0cf02adb3 --- /dev/null +++ b/3.6-rc/onbuild/Dockerfile @@ -0,0 +1,15 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM python:3.6-rc + +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/3.6/slim/Dockerfile b/3.6-rc/slim/Dockerfile similarity index 50% rename from 3.6/slim/Dockerfile rename to 3.6-rc/slim/Dockerfile index 4e0cc1294..1ed4c46c5 100644 --- a/3.6/slim/Dockerfile +++ b/3.6-rc/slim/Dockerfile @@ -1,29 +1,38 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + 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 \ + libgdbm3 \ 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 +ENV PYTHON_VERSION 3.6.0rc2 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 8.1.2 +ENV PYTHON_PIP_VERSION 9.0.1 RUN set -ex \ && buildDeps=' \ - curl \ gcc \ libbz2-dev \ libc6-dev \ + libgdbm-dev \ liblzma-dev \ libncurses-dev \ libreadline-dev \ @@ -32,12 +41,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 \ @@ -53,20 +64,33 @@ 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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' \) \ + \( -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 \ - && 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-rc/windows/windowsservercore/Dockerfile b/3.6-rc/windows/windowsservercore/Dockerfile new file mode 100644 index 000000000..29e4cad67 --- /dev/null +++ b/3.6-rc/windows/windowsservercore/Dockerfile @@ -0,0 +1,55 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV PYTHON_VERSION 3.6.0rc2 +ENV PYTHON_RELEASE 3.6.0 + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ + Write-Host ('Downloading {0} ...' -f $url); \ + (New-Object System.Net.WebClient).DownloadFile($url, 'python.exe'); \ + \ + Write-Host 'Installing ...'; \ +# https://docs.python.org/3.5/using/windows.html#installing-without-ui + Start-Process python.exe -Wait \ + -ArgumentList @( \ + '/quiet', \ + 'InstallAllUsers=1', \ + 'TargetDir=C:\Python', \ + 'PrependPath=1', \ + 'Shortcuts=0', \ + 'Include_doc=0', \ + 'Include_test=0' \ + ); \ + \ +# the installer updated PATH, so we should refresh our local value + $env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ...'; \ + Write-Host ' python --version'; python --version; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item python.exe -Force; \ + \ + $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \ + Write-Host ('Installing {0} ...' -f $pipInstall); \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + pip install --no-cache-dir --upgrade --force-reinstall $pipInstall; \ + \ + Write-Host 'Verifying pip install ...'; \ + pip --version; \ + \ + Write-Host 'Complete.'; + +CMD ["python"] diff --git a/3.6/Dockerfile b/3.6/Dockerfile deleted file mode 100644 index 348907912..000000000 --- a/3.6/Dockerfile +++ /dev/null @@ -1,76 +0,0 @@ -FROM buildpack-deps:jessie - -# divert many traces of Debian Python (so that they are not used by mistake) -# https://bugs.debian.org/33263 :( -RUN set -ex \ - && for bits in \ -# /etc/python* \ - /usr/bin/*2to3* \ - /usr/bin/*python* \ - /usr/bin/pdb* \ - /usr/bin/py* \ -# /usr/lib/python* \ -# /usr/share/python \ - ; do \ - dpkg-divert --rename "$bits"; \ - done - -# 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 - -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 \ - && buildDeps=' \ - 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 \ - && 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 \ - && pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ - && [ "$(pip list | 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 \ - && ln -s easy_install-3.6 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/3.6/alpine/Dockerfile b/3.6/alpine/Dockerfile deleted file mode 100644 index 45e1e0d9f..000000000 --- a/3.6/alpine/Dockerfile +++ /dev/null @@ -1,77 +0,0 @@ -FROM alpine:3.4 - -# 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 - -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 \ - && 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 del .fetch-deps \ - \ - && apk add --no-cache --virtual .build-deps \ - bzip2-dev \ - gcc \ - libc-dev \ - linux-headers \ - make \ - ncurses-dev \ - openssl-dev \ - pax-utils \ - readline-dev \ - sqlite-dev \ - tcl-dev \ - tk \ - tk-dev \ - xz-dev \ - zlib-dev \ - && 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" ] \ - && 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 \ - && ln -s easy_install-3.6 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-alpine.template b/Dockerfile-alpine.template new file mode 100644 index 000000000..79e1cd2e5 --- /dev/null +++ b/Dockerfile-alpine.template @@ -0,0 +1,104 @@ +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 \ + gdbm-dev \ + 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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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 000000000..56c6ef26d --- /dev/null +++ b/Dockerfile-debian.template @@ -0,0 +1,78 @@ +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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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/3.6/onbuild/Dockerfile b/Dockerfile-onbuild.template similarity index 86% rename from 3.6/onbuild/Dockerfile rename to Dockerfile-onbuild.template index 865aaa84c..2950ec194 100644 --- a/3.6/onbuild/Dockerfile +++ b/Dockerfile-onbuild.template @@ -1,4 +1,4 @@ -FROM python:3.6 +FROM python:%%PLACEHOLDER%% RUN mkdir -p /usr/src/app WORKDIR /usr/src/app diff --git a/Dockerfile-slim.template b/Dockerfile-slim.template new file mode 100644 index 000000000..6c64ab5a6 --- /dev/null +++ b/Dockerfile-slim.template @@ -0,0 +1,93 @@ +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 \ + libgdbm3 \ + 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 \ + libgdbm-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 \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ +# then we use "pip list" to ensure we don't have more than one pip version installed +# https://github.com/docker-library/python/pull/100 + && [ "$(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-windowsservercore.template b/Dockerfile-windowsservercore.template new file mode 100644 index 000000000..01d1a8c36 --- /dev/null +++ b/Dockerfile-windowsservercore.template @@ -0,0 +1,49 @@ +FROM microsoft/windowsservercore + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] + +ENV PYTHON_VERSION %%PLACEHOLDER%% +ENV PYTHON_RELEASE %%PLACEHOLDER%% + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION %%PLACEHOLDER%% + +RUN $url = ('https://www.python.org/ftp/python/{0}/python-{1}-amd64.exe' -f $env:PYTHON_RELEASE, $env:PYTHON_VERSION); \ + Write-Host ('Downloading {0} ...' -f $url); \ + (New-Object System.Net.WebClient).DownloadFile($url, 'python.exe'); \ + \ + Write-Host 'Installing ...'; \ +# https://docs.python.org/3.5/using/windows.html#installing-without-ui + Start-Process python.exe -Wait \ + -ArgumentList @( \ + '/quiet', \ + 'InstallAllUsers=1', \ + 'TargetDir=C:\Python', \ + 'PrependPath=1', \ + 'Shortcuts=0', \ + 'Include_doc=0', \ + 'Include_test=0' \ + ); \ + \ +# the installer updated PATH, so we should refresh our local value + $env:PATH = [Environment]::GetEnvironmentVariable('PATH', [EnvironmentVariableTarget]::Machine); \ + \ + Write-Host 'Verifying install ...'; \ + Write-Host ' python --version'; python --version; \ + \ + Write-Host 'Removing ...'; \ + Remove-Item python.exe -Force; \ + \ + $pipInstall = ('pip=={0}' -f $env:PYTHON_PIP_VERSION); \ + Write-Host ('Installing {0} ...' -f $pipInstall); \ +# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python +# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") +# https://github.com/docker-library/python/pull/143#issuecomment-241032683 + pip install --no-cache-dir --upgrade --force-reinstall $pipInstall; \ + \ + Write-Host 'Verifying pip install ...'; \ + pip --version; \ + \ + Write-Host 'Complete.'; + +CMD ["python"] diff --git a/README.md b/README.md index b291ff81c..f2748854a 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,11 @@ The full readme is generated over in [docker-library/docs](https://github.com/do See a change merged here that doesn't show up on the Docker Hub yet? Check [the "library/python" manifest file in the docker-library/official-images repo](https://github.com/docker-library/official-images/blob/master/library/python), especially [PRs with the "library/python" label on that repo](https://github.com/docker-library/official-images/labels/library%2Fpython). For more information about the official images process, see the [docker-library/official-images readme](https://github.com/docker-library/official-images/blob/master/README.md). -[![Travis CI](https://img.shields.io/travis/docker-library/python/master.svg)](https://travis-ci.org/docker-library/python/branches) +--- + +- [Travis CI: + ![build status badge](https://img.shields.io/travis/docker-library/python/master.svg)](https://travis-ci.org/docker-library/python/branches) +- [Automated `update.sh`: + ![build status badge](https://doi-janky.infosiftr.net/job/update.sh/job/python/badge/icon)](https://doi-janky.infosiftr.net/job/update.sh/job/python) diff --git a/generate-stackbrew-library.sh b/generate-stackbrew-library.sh index 8b166f2e8..43bf4a539 100755 --- a/generate-stackbrew-library.sh +++ b/generate-stackbrew-library.sh @@ -2,6 +2,7 @@ set -eu declare -A aliases=( + [3.6-rc]='rc' [3.5]='3 latest' [2.7]='2' ) @@ -67,10 +68,16 @@ for version in "${versions[@]}"; do Directory: $version EOE - for variant in slim alpine wheezy onbuild; do - [ -f "$version/$variant/Dockerfile" ] || continue + for v in \ + slim alpine wheezy onbuild \ + windows/windowsservercore windows/nanoserver \ + ; do + dir="$version/$v" + variant="$(basename "$v")" - commit="$(dirCommit "$version/$variant")" + [ -f "$dir/Dockerfile" ] || continue + + commit="$(dirCommit "$dir")" variantAliases=( "${versionAliases[@]/%/-$variant}" ) variantAliases=( "${variantAliases[@]//latest-/}" ) @@ -79,7 +86,8 @@ for version in "${versions[@]}"; do cat <<-EOE Tags: $(join ', ' "${variantAliases[@]}") GitCommit: $commit - Directory: $version/$variant + Directory: $dir EOE + [ "$variant" = "$v" ] || echo "Constraints: $variant" done done diff --git a/update.sh b/update.sh index 937bf378e..49d9a9fe8 100755 --- a/update.sh +++ b/update.sh @@ -1,5 +1,28 @@ #!/bin/bash set -e +shopt -s nullglob + +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")")" @@ -11,28 +34,77 @@ 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 - # Python 3.4.1 - fullVersion="$(curl -fsSL 'https://www.python.org/downloads/' | awk -F 'Python |' '/]+>Python '"$version"'./ { print $2 }' | grep -v 'rc' | sort -V | tail -1)" - # TODO figure out a better way to handle RCs than just filtering them out + rcGrepV='-v' + rcVersion="${version%-rc}" + if [ "$rcVersion" != "$version" ]; then + rcGrepV= + fi + + possibles=( $(curl -fsSL 'https://www.python.org/ftp/python/' | grep '&2 + exit 1 else + if [[ "$version" != 2.* ]]; then + for variant in \ + debian \ + alpine \ + slim \ + onbuild \ + windows/windowsservercore \ + ; do + if [ "$variant" = 'debian' ]; then + dir="$version" + else + dir="$version/$variant" + variant="$(basename "$variant")" + fi + [ -d "$dir" ] || continue + 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[$rcVersion]}"'/' \ + -e 's/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/' \ + -e 's/^(ENV PYTHON_RELEASE) .*/\1 '"${fullVersion%%[a-z]*}"'/' \ + -e 's/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/' \ + -e 's/^(FROM python):.*/\1:'"$version"'/' \ + "$version"/{,*/,*/*/}Dockerfile ) fi for variant in wheezy alpine slim; do