From 198e58cdc844d14e2a3ab0a8c55e379de28ec79c Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Thu, 8 Jun 2017 09:38:24 -0700 Subject: [PATCH] Adjust "pip" installation to match the recent changes in Python --- 2/Dockerfile | 32 ++++++++++++++++---------------- 2/slim/Dockerfile | 42 +++++++++++++++++++++--------------------- 3/Dockerfile | 35 ++++++++++++++++------------------- 3/slim/Dockerfile | 45 +++++++++++++++++++++------------------------ 4 files changed, 74 insertions(+), 80 deletions(-) diff --git a/2/Dockerfile b/2/Dockerfile index cf42ef0..bc84168 100644 --- a/2/Dockerfile +++ b/2/Dockerfile @@ -19,23 +19,23 @@ ENV PYPY_SHA256SUM c4fa3da42156bed4a9d912433b618a141e0c5161d7cc8c328786736ea5d1c # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 9.0.1 -RUN set -ex \ - && wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy2-v${PYPY_VERSION}-linux64.tar.bz2" \ - && echo "$PYPY_SHA256SUM pypy.tar.bz2" | sha256sum -c \ - && tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2 \ - && rm pypy.tar.bz2 \ +RUN set -ex; \ + wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy2-v${PYPY_VERSION}-linux64.tar.bz2"; \ + echo "$PYPY_SHA256SUM *pypy.tar.bz2" | sha256sum -c; \ + tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2; \ + rm pypy.tar.bz2 + +RUN set -ex; \ + \ + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ \ - && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && pypy /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ - && rm /tmp/get-pip.py \ -# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python -# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") -# https://github.com/docker-library/python/pull/143#issuecomment-241032683 - && pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ -# then we use "pip list" to ensure we don't have more than one pip version installed -# https://github.com/docker-library/python/pull/100 - && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + pypy get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ \ - && rm -rf ~/.cache + rm -f get-pip.py CMD ["pypy"] diff --git a/2/slim/Dockerfile b/2/slim/Dockerfile index e8ac1db..b02d4c3 100644 --- a/2/slim/Dockerfile +++ b/2/slim/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:jessie +FROM debian:jessie-slim # ensure local pypy is preferred over distribution python ENV PATH /usr/local/bin:$PATH @@ -21,30 +21,30 @@ ENV PYPY_SHA256SUM c4fa3da42156bed4a9d912433b618a141e0c5161d7cc8c328786736ea5d1c # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 9.0.1 -RUN set -ex \ - && fetchDeps=' \ +RUN set -ex; \ + \ + fetchDeps=' \ bzip2 \ wget \ - ' \ - && apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + '; \ + apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/*; \ + \ + wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy2-v${PYPY_VERSION}-linux64.tar.bz2"; \ + echo "$PYPY_SHA256SUM *pypy.tar.bz2" | sha256sum -c; \ + tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2; \ + rm pypy.tar.bz2; \ + \ + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ \ - && wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy2-v${PYPY_VERSION}-linux64.tar.bz2" \ - && echo "$PYPY_SHA256SUM pypy.tar.bz2" | sha256sum -c \ - && tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2 \ - && rm pypy.tar.bz2 \ + pypy get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ \ - && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && pypy /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ - && rm /tmp/get-pip.py \ -# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python -# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") -# https://github.com/docker-library/python/pull/143#issuecomment-241032683 - && pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ -# then we use "pip list" to ensure we don't have more than one pip version installed -# https://github.com/docker-library/python/pull/100 - && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + rm -f get-pip.py; \ \ - && apt-get purge -y --auto-remove $fetchDeps \ - && rm -rf ~/.cache + apt-get purge -y --auto-remove $fetchDeps CMD ["pypy"] diff --git a/3/Dockerfile b/3/Dockerfile index db3262c..a076b77 100644 --- a/3/Dockerfile +++ b/3/Dockerfile @@ -19,26 +19,23 @@ ENV PYPY_SHA256SUM 2abaa54d88c9b70b64c37083e7e430a1d3a8f78f8de92e484a988b7aca1e5 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 9.0.1 -RUN set -ex \ - && wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy3-v${PYPY_VERSION}-linux64.tar.bz2" \ - && echo "$PYPY_SHA256SUM pypy.tar.bz2" | sha256sum -c \ - && tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2 \ - && rm pypy.tar.bz2 \ +RUN set -ex; \ + wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy3-v${PYPY_VERSION}-linux64.tar.bz2"; \ + echo "$PYPY_SHA256SUM *pypy.tar.bz2" | sha256sum -c; \ + tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2; \ + rm pypy.tar.bz2 + +RUN set -ex; \ + \ + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ \ -# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere - && if [ ! -e /usr/local/bin/pip3 ]; then : \ - && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && pypy3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ - && rm /tmp/get-pip.py \ - ; fi \ -# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python -# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") -# https://github.com/docker-library/python/pull/143#issuecomment-241032683 - && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ -# then we use "pip list" to ensure we don't have more than one pip version installed -# https://github.com/docker-library/python/pull/100 - && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + pypy3 get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ \ - && rm -rf ~/.cache + rm -f get-pip.py CMD ["pypy3"] diff --git a/3/slim/Dockerfile b/3/slim/Dockerfile index 7774855..84777ff 100644 --- a/3/slim/Dockerfile +++ b/3/slim/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:jessie +FROM debian:jessie-slim # ensure local pypy is preferred over distribution python ENV PATH /usr/local/bin:$PATH @@ -21,33 +21,30 @@ ENV PYPY_SHA256SUM 2abaa54d88c9b70b64c37083e7e430a1d3a8f78f8de92e484a988b7aca1e5 # if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" ENV PYTHON_PIP_VERSION 9.0.1 -RUN set -ex \ - && fetchDeps=' \ +RUN set -ex; \ + \ + fetchDeps=' \ bzip2 \ wget \ - ' \ - && apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + '; \ + apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/*; \ + \ + wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy3-v${PYPY_VERSION}-linux64.tar.bz2"; \ + echo "$PYPY_SHA256SUM *pypy.tar.bz2" | sha256sum -c; \ + tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2; \ + rm pypy.tar.bz2; \ + \ + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ \ - && wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy3-v${PYPY_VERSION}-linux64.tar.bz2" \ - && echo "$PYPY_SHA256SUM pypy.tar.bz2" | sha256sum -c \ - && tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2 \ - && rm pypy.tar.bz2 \ + pypy3 get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ \ -# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere - && if [ ! -e /usr/local/bin/pip3 ]; then : \ - && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && pypy3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ - && rm /tmp/get-pip.py \ - ; fi \ -# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python -# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") -# https://github.com/docker-library/python/pull/143#issuecomment-241032683 - && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ -# then we use "pip list" to ensure we don't have more than one pip version installed -# https://github.com/docker-library/python/pull/100 - && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ + rm -f get-pip.py; \ \ - && apt-get purge -y --auto-remove $fetchDeps \ - && rm -rf ~/.cache + apt-get purge -y --auto-remove $fetchDeps CMD ["pypy3"]