Apply template to python:2.7 and python:3.6 which don't currently get the templates applied directly

This commit is contained in:
Tianon Gravi 2016-08-08 13:50:24 -07:00
parent 9a9021f213
commit f1bc9f7906
7 changed files with 137 additions and 75 deletions

View File

@ -1,15 +1,19 @@
FROM buildpack-deps:jessie FROM buildpack-deps:jessie
# ensure local python is used over debian python # ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846 # http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8 ENV LANG C.UTF-8
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported # runtime dependencies
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF RUN apt-get update && apt-get install -y --no-install-recommends \
tcl \
tk \
&& rm -rf /var/lib/apt/lists/*
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
ENV PYTHON_VERSION 2.7.12 ENV PYTHON_VERSION 2.7.12
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
@ -20,13 +24,10 @@ RUN set -ex \
tcl-dev \ tcl-dev \
tk-dev \ tk-dev \
' \ ' \
&& runDeps=' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
tcl \ \
tk \ && 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" \
&& 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)" \ && export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \
@ -42,9 +43,13 @@ RUN set -ex \
&& make -j$(nproc) \ && make -j$(nproc) \
&& make install \ && make install \
&& ldconfig \ && ldconfig \
&& curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ \
&& pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ && python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
&& rm /tmp/get-pip.py \
&& pip install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
\
&& find /usr/local -depth \ && find /usr/local -depth \
\( \ \( \
\( -type d -a -name test -o -name tests \) \ \( -type d -a -name test -o -name tests \) \

View File

@ -1,5 +1,8 @@
FROM alpine:3.4 FROM alpine:3.4
# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846 # http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8 ENV LANG C.UTF-8
@ -8,18 +11,21 @@ ENV LANG C.UTF-8
# the other runtime dependencies for Python are installed later # the other runtime dependencies for Python are installed later
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
ENV PYTHON_VERSION 2.7.12 ENV PYTHON_VERSION 2.7.12
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 8.1.2 ENV PYTHON_PIP_VERSION 8.1.2
RUN set -ex \ RUN set -ex \
&& apk add --no-cache --virtual .fetch-deps curl gnupg tar xz \ && apk add --no-cache --virtual .fetch-deps \
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ gnupg \
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ 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)" \ && export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \
@ -35,6 +41,7 @@ RUN set -ex \
linux-headers \ linux-headers \
make \ make \
ncurses-dev \ ncurses-dev \
openssl \
openssl-dev \ openssl-dev \
pax-utils \ pax-utils \
readline-dev \ readline-dev \
@ -43,15 +50,22 @@ RUN set -ex \
tk \ tk \
tk-dev \ tk-dev \
zlib-dev \ zlib-dev \
# add build deps before removing fetch deps in case there's overlap
&& apk del .fetch-deps \
\
&& cd /usr/src/python \ && cd /usr/src/python \
&& ./configure \ && ./configure \
--enable-shared \ --enable-shared \
--enable-unicode=ucs4 \ --enable-unicode=ucs4 \
&& make -j$(getconf _NPROCESSORS_ONLN) \ && make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \ && make install \
&& curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ \
&& pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ && python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
&& rm /tmp/get-pip.py \
&& pip install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
\
&& find /usr/local -depth \ && find /usr/local -depth \
\( \ \( \
\( -type d -a -name test -o -name tests \) \ \( -type d -a -name test -o -name tests \) \
@ -66,7 +80,7 @@ RUN set -ex \
| sort -u \ | sort -u \
)" \ )" \
&& apk add --virtual .python-rundeps $runDeps \ && apk add --virtual .python-rundeps $runDeps \
&& apk del .build-deps .fetch-deps \ && apk del .build-deps \
&& rm -rf /usr/src/python ~/.cache && rm -rf /usr/src/python ~/.cache
CMD ["python2"] CMD ["python2"]

View File

@ -1,21 +1,20 @@
FROM debian:jessie FROM debian:jessie
# ensure local python is used over debian python # ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846 # http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8 ENV LANG C.UTF-8
# runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
libsqlite3-0 \ libsqlite3-0 \
libssl1.0.0 \ libssl1.0.0 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
ENV PYTHON_VERSION 2.7.12 ENV PYTHON_VERSION 2.7.12
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
@ -23,7 +22,6 @@ ENV PYTHON_PIP_VERSION 8.1.2
RUN set -ex \ RUN set -ex \
&& buildDeps=' \ && buildDeps=' \
curl \
gcc \ gcc \
libbz2-dev \ libbz2-dev \
libc6-dev \ libc6-dev \
@ -34,12 +32,14 @@ RUN set -ex \
make \ make \
tcl-dev \ tcl-dev \
tk-dev \ tk-dev \
wget \
xz-utils \ xz-utils \
zlib1g-dev \ zlib1g-dev \
' \ ' \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && 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)" \ && export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \
@ -55,9 +55,13 @@ RUN set -ex \
&& make -j$(nproc) \ && make -j$(nproc) \
&& make install \ && make install \
&& ldconfig \ && ldconfig \
&& curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ \
&& pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ && python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
&& rm /tmp/get-pip.py \
&& pip install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
\
&& find /usr/local -depth \ && find /usr/local -depth \
\( \ \( \
\( -type d -a -name test -o -name tests \) \ \( -type d -a -name test -o -name tests \) \

View File

@ -1,15 +1,19 @@
FROM buildpack-deps:wheezy FROM buildpack-deps:wheezy
# ensure local python is used over debian python # ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846 # http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8 ENV LANG C.UTF-8
# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported # runtime dependencies
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF RUN apt-get update && apt-get install -y --no-install-recommends \
tcl \
tk \
&& rm -rf /var/lib/apt/lists/*
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
ENV PYTHON_VERSION 2.7.12 ENV PYTHON_VERSION 2.7.12
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
@ -20,13 +24,10 @@ RUN set -ex \
tcl-dev \ tcl-dev \
tk-dev \ tk-dev \
' \ ' \
&& runDeps=' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
tcl \ \
tk \ && 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" \
&& 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)" \ && export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \
@ -42,9 +43,13 @@ RUN set -ex \
&& make -j$(nproc) \ && make -j$(nproc) \
&& make install \ && make install \
&& ldconfig \ && ldconfig \
&& curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ \
&& pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ && python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
&& rm /tmp/get-pip.py \
&& pip install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
\
&& find /usr/local -depth \ && find /usr/local -depth \
\( \ \( \
\( -type d -a -name test -o -name tests \) \ \( -type d -a -name test -o -name tests \) \

View File

@ -1,15 +1,19 @@
FROM buildpack-deps:jessie FROM buildpack-deps:jessie
# ensure local python is used over debian python # ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846 # http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8 ENV LANG C.UTF-8
# gpg: key AA65421D: public key "Ned Deily (Python release signing key) <nad@acm.org>" imported # runtime dependencies
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D RUN apt-get update && apt-get install -y --no-install-recommends \
tcl \
tk \
&& rm -rf /var/lib/apt/lists/*
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.0a3 ENV PYTHON_VERSION 3.6.0a3
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
@ -20,13 +24,10 @@ RUN set -ex \
tcl-dev \ tcl-dev \
tk-dev \ tk-dev \
' \ ' \
&& runDeps=' \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
tcl \ \
tk \ && 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" \
&& 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)" \ && export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \
@ -42,8 +43,16 @@ RUN set -ex \
&& make -j$(nproc) \ && make -j$(nproc) \
&& make install \ && make install \
&& ldconfig \ && ldconfig \
&& pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ \
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ # explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
&& rm /tmp/get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
\
&& find /usr/local -depth \ && find /usr/local -depth \
\( \ \( \
\( -type d -a -name test -o -name tests \) \ \( -type d -a -name test -o -name tests \) \
@ -55,7 +64,7 @@ RUN set -ex \
# make some useful symlinks that are expected to exist # make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \ 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 idle3 idle \
&& ln -s pydoc3 pydoc \ && ln -s pydoc3 pydoc \
&& ln -s python3 python \ && ln -s python3 python \

View File

@ -1,5 +1,8 @@
FROM alpine:3.4 FROM alpine:3.4
# ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846 # http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8 ENV LANG C.UTF-8
@ -8,18 +11,21 @@ ENV LANG C.UTF-8
# the other runtime dependencies for Python are installed later # the other runtime dependencies for Python are installed later
RUN apk add --no-cache ca-certificates RUN apk add --no-cache ca-certificates
# gpg: key AA65421D: public key "Ned Deily (Python release signing key) <nad@acm.org>" imported
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.0a3 ENV PYTHON_VERSION 3.6.0a3
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 8.1.2 ENV PYTHON_PIP_VERSION 8.1.2
RUN set -ex \ RUN set -ex \
&& apk add --no-cache --virtual .fetch-deps curl gnupg tar xz \ && apk add --no-cache --virtual .fetch-deps \
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ gnupg \
&& curl -fSL "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ 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)" \ && export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \
@ -27,7 +33,6 @@ RUN set -ex \
&& mkdir -p /usr/src/python \ && mkdir -p /usr/src/python \
&& tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \
&& rm python.tar.xz \ && rm python.tar.xz \
&& apk del .fetch-deps \
\ \
&& apk add --no-cache --virtual .build-deps \ && apk add --no-cache --virtual .build-deps \
bzip2-dev \ bzip2-dev \
@ -36,6 +41,7 @@ RUN set -ex \
linux-headers \ linux-headers \
make \ make \
ncurses-dev \ ncurses-dev \
openssl \
openssl-dev \ openssl-dev \
pax-utils \ pax-utils \
readline-dev \ readline-dev \
@ -45,14 +51,25 @@ RUN set -ex \
tk-dev \ tk-dev \
xz-dev \ xz-dev \
zlib-dev \ zlib-dev \
# add build deps before removing fetch deps in case there's overlap
&& apk del .fetch-deps \
\
&& cd /usr/src/python \ && cd /usr/src/python \
&& ./configure \ && ./configure \
--enable-loadable-sqlite-extensions \ --enable-loadable-sqlite-extensions \
--enable-shared \ --enable-shared \
&& make -j$(getconf _NPROCESSORS_ONLN) \ && make -j$(getconf _NPROCESSORS_ONLN) \
&& make install \ && make install \
&& pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ \
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ # explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
&& rm /tmp/get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
\
&& find /usr/local -depth \ && find /usr/local -depth \
\( \ \( \
\( -type d -a -name test -o -name tests \) \ \( -type d -a -name test -o -name tests \) \
@ -72,7 +89,7 @@ RUN set -ex \
# make some useful symlinks that are expected to exist # make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \ 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 idle3 idle \
&& ln -s pydoc3 pydoc \ && ln -s pydoc3 pydoc \
&& ln -s python3 python \ && ln -s python3 python \

View File

@ -1,21 +1,20 @@
FROM debian:jessie FROM debian:jessie
# ensure local python is used over debian python # ensure local python is preferred over distribution python
ENV PATH /usr/local/bin:$PATH ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846 # http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. # > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8 ENV LANG C.UTF-8
# runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
libsqlite3-0 \ libsqlite3-0 \
libssl1.0.0 \ libssl1.0.0 \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# gpg: key AA65421D: public key "Ned Deily (Python release signing key) <nad@acm.org>" imported
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.0a3 ENV PYTHON_VERSION 3.6.0a3
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
@ -23,7 +22,6 @@ ENV PYTHON_PIP_VERSION 8.1.2
RUN set -ex \ RUN set -ex \
&& buildDeps=' \ && buildDeps=' \
curl \
gcc \ gcc \
libbz2-dev \ libbz2-dev \
libc6-dev \ libc6-dev \
@ -35,12 +33,14 @@ RUN set -ex \
make \ make \
tcl-dev \ tcl-dev \
tk-dev \ tk-dev \
wget \
xz-utils \ xz-utils \
zlib1g-dev \ zlib1g-dev \
' \ ' \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ && 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)" \ && export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \
&& gpg --batch --verify python.tar.xz.asc python.tar.xz \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \
@ -56,8 +56,16 @@ RUN set -ex \
&& make -j$(nproc) \ && make -j$(nproc) \
&& make install \ && make install \
&& ldconfig \ && ldconfig \
&& pip3 install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ \
&& [ "$(pip list | awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ # explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
&& rm /tmp/get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade "pip==$PYTHON_PIP_VERSION" \
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
\
&& find /usr/local -depth \ && find /usr/local -depth \
\( \ \( \
\( -type d -a -name test -o -name tests \) \ \( -type d -a -name test -o -name tests \) \
@ -69,7 +77,7 @@ RUN set -ex \
# make some useful symlinks that are expected to exist # make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \ 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 idle3 idle \
&& ln -s pydoc3 pydoc \ && ln -s pydoc3 pydoc \
&& ln -s python3 python \ && ln -s python3 python \