|
| 1 | +# |
| 2 | +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" |
| 3 | +# |
| 4 | +# PLEASE DO NOT EDIT IT DIRECTLY. |
| 5 | +# |
| 6 | + |
| 7 | +FROM debian:stretch-slim |
| 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 | + ca-certificates \ |
| 19 | + libexpat1 \ |
| 20 | + libffi6 \ |
| 21 | + libgdbm3 \ |
| 22 | + libsqlite3-0 \ |
| 23 | + libssl1.1 \ |
| 24 | + && rm -rf /var/lib/apt/lists/* |
| 25 | + |
| 26 | +ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D |
| 27 | +ENV PYTHON_VERSION 3.6.3 |
| 28 | + |
| 29 | +RUN set -ex \ |
| 30 | + && buildDeps=" \ |
| 31 | + dpkg-dev \ |
| 32 | + gcc \ |
| 33 | + libbz2-dev \ |
| 34 | + libc6-dev \ |
| 35 | + libexpat1-dev \ |
| 36 | + libffi-dev \ |
| 37 | + libgdbm-dev \ |
| 38 | + liblzma-dev \ |
| 39 | + libncurses-dev \ |
| 40 | + libreadline-dev \ |
| 41 | + libsqlite3-dev \ |
| 42 | + libssl-dev \ |
| 43 | + make \ |
| 44 | + tcl-dev \ |
| 45 | + tk-dev \ |
| 46 | + wget \ |
| 47 | + xz-utils \ |
| 48 | + zlib1g-dev \ |
| 49 | +# as of Stretch, "gpg" is no longer included by default |
| 50 | + $(command -v gpg > /dev/null || echo 'gnupg2 dirmngr') \ |
| 51 | + " \ |
| 52 | + && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ |
| 53 | + \ |
| 54 | + && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ |
| 55 | + && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ |
| 56 | + && export GNUPGHOME="$(mktemp -d)" \ |
| 57 | + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$GPG_KEY" \ |
| 58 | + && gpg --batch --verify python.tar.xz.asc python.tar.xz \ |
| 59 | + && rm -rf "$GNUPGHOME" python.tar.xz.asc \ |
| 60 | + && mkdir -p /usr/src/python \ |
| 61 | + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ |
| 62 | + && rm python.tar.xz \ |
| 63 | + \ |
| 64 | + && cd /usr/src/python \ |
| 65 | + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ |
| 66 | + && ./configure \ |
| 67 | + --build="$gnuArch" \ |
| 68 | + --enable-loadable-sqlite-extensions \ |
| 69 | + --enable-shared \ |
| 70 | + --with-system-expat \ |
| 71 | + --with-system-ffi \ |
| 72 | + --without-ensurepip \ |
| 73 | + && make -j "$(nproc)" \ |
| 74 | + && make install \ |
| 75 | + && ldconfig \ |
| 76 | + \ |
| 77 | + && apt-get purge -y --auto-remove $buildDeps \ |
| 78 | + \ |
| 79 | + && find /usr/local -depth \ |
| 80 | + \( \ |
| 81 | + \( -type d -a \( -name test -o -name tests \) \) \ |
| 82 | + -o \ |
| 83 | + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ |
| 84 | + \) -exec rm -rf '{}' + \ |
| 85 | + && rm -rf /usr/src/python |
| 86 | + |
| 87 | +# make some useful symlinks that are expected to exist |
| 88 | +RUN cd /usr/local/bin \ |
| 89 | + && ln -s idle3 idle \ |
| 90 | + && ln -s pydoc3 pydoc \ |
| 91 | + && ln -s python3 python \ |
| 92 | + && ln -s python3-config python-config |
| 93 | + |
| 94 | +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" |
| 95 | +ENV PYTHON_PIP_VERSION 9.0.1 |
| 96 | + |
| 97 | +RUN set -ex; \ |
| 98 | + \ |
| 99 | + apt-get update; \ |
| 100 | + apt-get install -y --no-install-recommends wget; \ |
| 101 | + rm -rf /var/lib/apt/lists/*; \ |
| 102 | + \ |
| 103 | + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ |
| 104 | + \ |
| 105 | + apt-get purge -y --auto-remove wget; \ |
| 106 | + \ |
| 107 | + python get-pip.py \ |
| 108 | + --disable-pip-version-check \ |
| 109 | + --no-cache-dir \ |
| 110 | + "pip==$PYTHON_PIP_VERSION" \ |
| 111 | + ; \ |
| 112 | + pip --version; \ |
| 113 | + \ |
| 114 | + find /usr/local -depth \ |
| 115 | + \( \ |
| 116 | + \( -type d -a \( -name test -o -name tests \) \) \ |
| 117 | + -o \ |
| 118 | + \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \ |
| 119 | + \) -exec rm -rf '{}' +; \ |
| 120 | + rm -f get-pip.py |
| 121 | + |
| 122 | +CMD ["python3"] |
0 commit comments