65 lines
2.2 KiB
Docker
65 lines
2.2 KiB
Docker
FROM buildpack-deps:jessie
|
|
|
|
# ensure local python is used over debian python
|
|
ENV PATH /usr/local/bin:$PATH
|
|
|
|
# http://bugs.python.org/issue19846
|
|
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
|
|
ENV LANG C.UTF-8
|
|
|
|
# gpg: key AA65421D: public key "Ned Deily (Python release signing key) <nad@acm.org>" imported
|
|
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
|
|
|
|
ENV PYTHON_VERSION 3.6.0a3
|
|
|
|
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
|
|
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"]
|