@@ -23,7 +23,8 @@ ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
2323ENV PYTHON_VERSION 2.7.15
2424
2525RUN set -ex \
26- && buildDeps=" \
26+ && savedAptMark="$(apt-mark showmanual)" \
27+ && apt-get update && apt-get install -y --no-install-recommends \
2728 dpkg-dev \
2829 gcc \
2930 libbz2-dev \
@@ -42,8 +43,7 @@ RUN set -ex \
4243 zlib1g-dev \
4344# as of Stretch, "gpg" is no longer included by default
4445 $(command -v gpg > /dev/null || echo 'gnupg dirmngr' ) \
45- " \
46- && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
46+ && rm -rf /var/lib/apt/lists/* \
4747 \
4848 && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
4949 && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
@@ -65,28 +65,35 @@ RUN set -ex \
6565 && make install \
6666 && ldconfig \
6767 \
68- && apt-get purge -y --auto-remove $buildDeps \
68+ && apt-mark auto '.*' > /dev/null \
69+ && apt-mark manual $savedAptMark \
70+ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
6971 \
7072 && find /usr/local -depth \
7173 \( \
7274 \( -type d -a \( -name test -o -name tests \) \) \
7375 -o \
7476 \( -type f -a \( -name '*.pyc' -o -name '*.pyo' \) \) \
7577 \) -exec rm -rf '{}' + \
76- && rm -rf /usr/src/python
78+ && rm -rf /usr/src/python \
79+ \
80+ && python2 --version
7781
7882# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
7983ENV PYTHON_PIP_VERSION 10.0.1
8084
8185RUN set -ex; \
8286 \
87+ savedAptMark="$(apt-mark showmanual)" ; \
8388 apt-get update; \
8489 apt-get install -y --no-install-recommends wget; \
8590 rm -rf /var/lib/apt/lists/*; \
8691 \
8792 wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py' ; \
8893 \
89- apt-get purge -y --auto-remove wget; \
94+ apt-mark auto '.*' > /dev/null; \
95+ [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; \
96+ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
9097 \
9198 python get-pip.py \
9299 --disable-pip-version-check \
0 commit comments