Skip to content

Instantly share code, notes, and snippets.

@honnix
Last active September 15, 2018 12:43
Show Gist options
  • Save honnix/91c51d72d31f40f1e033f42d7dbfc778 to your computer and use it in GitHub Desktop.
Save honnix/91c51d72d31f40f1e033f42d7dbfc778 to your computer and use it in GitHub Desktop.
FROM ubuntu:14.04
COPY install-python.sh /
RUN /install-python.sh
RUN pip install manhole
ENV PYTHONMANHOLE 'daemon_connection=True'
#!/bin/bash -ex
LANG=C.UTF-8
PYTHON_VERSION=2.7.14
cd /
apt-get update
buildDeps=" \
dpkg-dev \
gcc \
libbz2-dev \
libc6-dev \
libdb-dev \
libgdbm-dev \
libncursesw5-dev \
libreadline-dev \
libssl-dev \
libsqlite3-dev \
make \
xz-utils \
zlib1g-dev"
apt-get install -y curl $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/*
curl -k -o python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"
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-shared \
--enable-unicode=ucs4
make -j "$(nproc)"
make install
ldconfig
apt-get purge -y --auto-remove $buildDeps
find /usr/local -depth \
\( \
\( -type d -a \( -name test -o -name tests \) \) \
-o \
\( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
\) -exec rm -rf '{}' +
rm -rf /usr/src/python
PYTHON_PIP_VERSION=10.0.1
cd /
curl -k -o get-pip.py 'https://bootstrap.pypa.io/get-pip.py'
python get-pip.py \
--disable-pip-version-check \
--no-cache-dir \
"pip==$PYTHON_PIP_VERSION"
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 '{}' +
rm -f get-pip.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment