Skip to content

Instantly share code, notes, and snippets.

@erinxocon
Created October 17, 2019 21:10
Show Gist options
  • Save erinxocon/80e64a876410df79d728ede7659475cd to your computer and use it in GitHub Desktop.
Save erinxocon/80e64a876410df79d728ede7659475cd to your computer and use it in GitHub Desktop.
Python 1.6.1 Ubuntu Dockerfile
FROM ubuntu:19.04
ARG DEBIAN_FRONTEND=noninteractive
# ensure local python is preferred over distribution 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
# https://github.com/docker-library/python/issues/147
ENV PYTHONIOENCODING UTF-8
# runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
netbase \
&& rm -rf /var/lib/apt/lists/*
RUN set -ex \
\
&& savedAptMark="$(apt-mark showmanual)" \
&& apt-get update && apt-get install -y --no-install-recommends \
dpkg-dev \
gcc \
libbz2-dev \
libc6-dev \
libdb-dev \
libgdbm-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
make \
tk-dev \
wget \
xz-utils \
zlib1g-dev \
\
&& wget -O python.tar.gz "https://legacy.python.org/download/releases/1.6.1/Python-1.6.1.tar.gz" \
&& mkdir -p /usr/src/python \
&& tar -xzf python.tar.gz -C /usr/src/python --strip-components=1 \
&& rm python.tar.gz \
\
&& cd /usr/src/python \
&& gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \
&& ./configure \
&& make \
&& make install \
&& ldconfig \
\
&& apt-mark auto '.*' > /dev/null \
&& apt-mark manual $savedAptMark \
&& find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' \
| awk '/=>/ { print $(NF-1) }' \
| sort -u \
| xargs -r dpkg-query --search \
| cut -d: -f1 \
| sort -u \
| xargs -r apt-mark manual \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* \
\
&& 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
CMD ["python"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment