|
| 1 | +# |
| 2 | +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" |
| 3 | +# |
| 4 | +# PLEASE DO NOT EDIT IT DIRECTLY. |
| 5 | +# |
| 6 | + |
| 7 | +FROM buildpack-deps:stretch |
| 8 | + |
| 9 | +# ensure local python is preferred over distribution python |
| 10 | +ENV PATH /usr/local/bin:$PATH |
| 11 | + |
| 12 | +# http://bugs.python.org/issue19846 |
| 13 | +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. |
| 14 | +ENV LANG C.UTF-8 |
| 15 | + |
| 16 | +# runtime dependencies |
| 17 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 18 | + tcl \ |
| 19 | + tk \ |
| 20 | + && rm -rf /var/lib/apt/lists/* |
| 21 | + |
| 22 | +ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D |
| 23 | +ENV PYTHON_VERSION 3.6.1 |
| 24 | + |
| 25 | +RUN set -ex \ |
| 26 | + && buildDeps=' \ |
| 27 | + dpkg-dev \ |
| 28 | + tcl-dev \ |
| 29 | + tk-dev \ |
| 30 | + ' \ |
| 31 | + && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ |
| 32 | + \ |
| 33 | + && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ |
| 34 | + && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ |
| 35 | + && export GNUPGHOME="$(mktemp -d)" \ |
| 36 | + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ |
| 37 | + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ |
| 38 | + && rm -rf "$GNUPGHOME" python.tar.xz.asc \ |
| 39 | + && mkdir -p /usr/src/python \ |
| 40 | + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ |
| 41 | + && rm python.tar.xz \ |
| 42 | + \ |
| 43 | + && cd /usr/src/python \ |
| 44 | + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ |
| 45 | + && ./configure \ |
| 46 | + --build="$gnuArch" \ |
| 47 | + --enable-loadable-sqlite-extensions \ |
| 48 | + --enable-shared \ |
| 49 | + --with-system-expat \ |
| 50 | + --with-system-ffi \ |
| 51 | + --without-ensurepip \ |
| 52 | + && make -j "$(nproc)" \ |
| 53 | + && make install \ |
| 54 | + && ldconfig \ |
| 55 | + \ |
| 56 | + && apt-get purge -y --auto-remove $buildDeps \ |
| 57 | + \ |
| 58 | + && find /usr/local -depth \ |
| 59 | + \( \ |
| 60 | + \( -type d -a -name test -o -name tests \) \ |
| 61 | + -o \ |
| 62 | + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ |
| 63 | + \) -exec rm -rf '{}' + \ |
| 64 | + && rm -rf /usr/src/python |
| 65 | + |
| 66 | +# make some useful symlinks that are expected to exist |
| 67 | +RUN cd /usr/local/bin \ |
| 68 | + && ln -s idle3 idle \ |
| 69 | + && ln -s pydoc3 pydoc \ |
| 70 | + && ln -s python3 python \ |
| 71 | + && ln -s python3-config python-config |
| 72 | + |
| 73 | +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" |
| 74 | +ENV PYTHON_PIP_VERSION 9.0.1 |
| 75 | + |
| 76 | +RUN set -ex; \ |
| 77 | + \ |
| 78 | + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ |
| 79 | + \ |
| 80 | + python get-pip.py \ |
| 81 | + --disable-pip-version-check \ |
| 82 | + --no-cache-dir \ |
| 83 | + "pip==$PYTHON_PIP_VERSION" \ |
| 84 | + ; \ |
| 85 | + pip --version; \ |
| 86 | + \ |
| 87 | + find /usr/local -depth \ |
| 88 | + \( \ |
| 89 | + \( -type d -a -name test -o -name tests \) \ |
| 90 | + -o \ |
| 91 | + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ |
| 92 | + \) -exec rm -rf '{}' +; \ |
| 93 | + rm -f get-pip.py |
| 94 | + |
| 95 | +CMD ["python3"] |
0 commit comments