|
| 1 | +FROM buildpack-deps:squeeze |
| 2 | + |
| 3 | +# remove several traces of debian python |
| 4 | +RUN apt-get purge -y python.* |
| 5 | + |
| 6 | +# http://bugs.python.org/issue19846 |
| 7 | +# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK. |
| 8 | +ENV LANG C.UTF-8 |
| 9 | + |
| 10 | +# gpg: key 18ADD4FF: public key "Benjamin Peterson <benjamin@python.org>" imported |
| 11 | +RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF |
| 12 | + |
| 13 | +ENV PYTHON_VERSION 2.7.11 |
| 14 | + |
| 15 | +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'" |
| 16 | +ENV PYTHON_PIP_VERSION 7.1.2 |
| 17 | + |
| 18 | +RUN set -x \ |
| 19 | + && mkdir -p /usr/src/python \ |
| 20 | + && curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz" -o python.tar.xz \ |
| 21 | + && curl -fSL "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz.asc" -o python.tar.xz.asc \ |
| 22 | + && gpg --verify python.tar.xz.asc \ |
| 23 | + && tar -xJC /usr/src/python --strip-components=1 -f python.tar.xz \ |
| 24 | + && rm python.tar.xz* \ |
| 25 | + && cd /usr/src/python \ |
| 26 | + && ./configure --enable-shared --enable-unicode=ucs4 \ |
| 27 | + && make -j$(nproc) \ |
| 28 | + && make install \ |
| 29 | + && ldconfig \ |
| 30 | + && curl -fSL 'https://bootstrap.pypa.io/get-pip.py' | python2 \ |
| 31 | + && pip install --no-cache-dir --upgrade pip==$PYTHON_PIP_VERSION \ |
| 32 | + && find /usr/local \ |
| 33 | + \( -type d -a -name test -o -name tests \) \ |
| 34 | + -o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ |
| 35 | + -exec rm -rf '{}' + \ |
| 36 | + && rm -rf /usr/src/python |
| 37 | + |
| 38 | +# install "virtualenv", since the vast majority of users of this image will want it |
| 39 | +RUN pip install --no-cache-dir virtualenv |
| 40 | + |
| 41 | +CMD ["python2"] |
0 commit comments