Skip to content

Commit 01de162

Browse files
authored
Merge pull request #10 from JayH5/python-equality
Bring up to equivalent quality as Python images
2 parents ed98d2d + 8a1c5f0 commit 01de162

File tree

5 files changed

+131
-34
lines changed

5 files changed

+131
-34
lines changed

2/Dockerfile

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,41 @@
11
FROM buildpack-deps:jessie
22

3-
# remove several traces of debian python
4-
RUN apt-get purge -y python.*
3+
# ensure local pypy is preferred over distribution python
4+
ENV PATH /usr/local/bin:$PATH
55

66
# http://bugs.python.org/issue19846
77
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
88
ENV LANG C.UTF-8
99

10-
ENV PYPY_VERSION 5.4.1
10+
# runtime dependencies
11+
RUN apt-get update && apt-get install -y --no-install-recommends \
12+
tcl \
13+
tk \
14+
&& rm -rf /var/lib/apt/lists/*
1115

12-
RUN set -x \
13-
&& curl -SL "https://bitbucket.org/pypy/pypy/downloads/pypy2-v${PYPY_VERSION}-linux64.tar.bz2" \
14-
| tar -xjC /usr/local --strip-components=1
16+
ENV PYPY_VERSION 5.4.1
17+
ENV PYPY_SHA256SUM 9c85319778224d7fb0c348f55fe3fada15bb579c5f3870a13ad63b42a737dd72
1518

1619
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
1720
ENV PYTHON_PIP_VERSION 8.1.2
18-
RUN curl -SL 'https://bootstrap.pypa.io/get-pip.py' | pypy \
19-
&& pip install --upgrade pip==$PYTHON_PIP_VERSION
21+
22+
RUN set -ex \
23+
&& wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy2-v${PYPY_VERSION}-linux64.tar.bz2" \
24+
&& echo "$PYPY_SHA256SUM pypy.tar.bz2" | sha256sum -c \
25+
&& tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2 \
26+
&& rm pypy.tar.bz2 \
27+
\
28+
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
29+
&& pypy /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
30+
&& rm /tmp/get-pip.py \
31+
# 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
32+
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
33+
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
34+
&& pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
35+
# then we use "pip list" to ensure we don't have more than one pip version installed
36+
# https://github.com/docker-library/python/pull/100
37+
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
38+
\
39+
&& rm -rf ~/.cache
2040

2141
CMD ["pypy"]

2/slim/Dockerfile

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM debian:jessie
22

3-
# remove several traces of debian python
4-
RUN apt-get purge -y python.*
3+
# ensure local pypy is preferred over distribution python
4+
ENV PATH /usr/local/bin:$PATH
55

66
# http://bugs.python.org/issue19846
77
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
@@ -10,19 +10,40 @@ ENV LANG C.UTF-8
1010
RUN apt-get update && apt-get install -y --no-install-recommends \
1111
ca-certificates \
1212
libexpat1 \
13+
libffi6 \
1314
libsqlite3-0 \
1415
&& rm -rf /var/lib/apt/lists/*
1516

1617
ENV PYPY_VERSION 5.4.1
18+
ENV PYPY_SHA256SUM 9c85319778224d7fb0c348f55fe3fada15bb579c5f3870a13ad63b42a737dd72
19+
1720
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
1821
ENV PYTHON_PIP_VERSION 8.1.2
1922

20-
RUN set -x \
21-
&& apt-get update && apt-get install -y bzip2 curl --no-install-recommends && rm -rf /var/lib/apt/lists/* \
22-
&& curl -SL "https://bitbucket.org/pypy/pypy/downloads/pypy2-v${PYPY_VERSION}-linux64.tar.bz2" \
23-
| tar -xjC /usr/local --strip-components=1 \
24-
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | pypy \
25-
&& pip install --upgrade pip==$PYTHON_PIP_VERSION \
26-
&& apt-get purge -y --auto-remove bzip2 curl
23+
RUN set -ex \
24+
&& fetchDeps=' \
25+
bzip2 \
26+
wget \
27+
' \
28+
&& apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
29+
\
30+
&& wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy2-v${PYPY_VERSION}-linux64.tar.bz2" \
31+
&& echo "$PYPY_SHA256SUM pypy.tar.bz2" | sha256sum -c \
32+
&& tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2 \
33+
&& rm pypy.tar.bz2 \
34+
\
35+
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
36+
&& pypy /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
37+
&& rm /tmp/get-pip.py \
38+
# 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
39+
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
40+
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
41+
&& pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
42+
# then we use "pip list" to ensure we don't have more than one pip version installed
43+
# https://github.com/docker-library/python/pull/100
44+
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
45+
\
46+
&& apt-get purge -y --auto-remove $fetchDeps \
47+
&& rm -rf ~/.cache
2748

2849
CMD ["pypy"]

3/Dockerfile

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,44 @@
11
FROM buildpack-deps:jessie
22

3-
# remove several traces of debian python
4-
RUN apt-get purge -y python.*
3+
# ensure local pypy is preferred over distribution python
4+
ENV PATH /usr/local/bin:$PATH
55

66
# http://bugs.python.org/issue19846
77
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
88
ENV LANG C.UTF-8
99

10-
ENV PYPY_VERSION 5.2.0-alpha1
10+
# runtime dependencies
11+
RUN apt-get update && apt-get install -y --no-install-recommends \
12+
tcl \
13+
tk \
14+
&& rm -rf /var/lib/apt/lists/*
1115

12-
RUN set -x \
13-
&& curl -SL "https://bitbucket.org/pypy/pypy/downloads/pypy3.3-v${PYPY_VERSION}-linux64.tar.bz2" \
14-
| tar -xjC /usr/local --strip-components=1
16+
ENV PYPY_VERSION 5.2.0-alpha1
17+
ENV PYPY_SHA256SUM f5e66ab24267d6ddf662d07c512d06c10ebc732ae62093dabbd775ac63b9060a
1518

1619
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
1720
ENV PYTHON_PIP_VERSION 8.1.2
18-
RUN curl -SL 'https://bootstrap.pypa.io/get-pip.py' | pypy3 \
19-
&& pip install --upgrade pip==$PYTHON_PIP_VERSION
21+
22+
RUN set -ex \
23+
&& wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy3.3-v${PYPY_VERSION}-linux64.tar.bz2" \
24+
&& echo "$PYPY_SHA256SUM pypy.tar.bz2" | sha256sum -c \
25+
&& tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2 \
26+
&& rm pypy.tar.bz2 \
27+
\
28+
# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere
29+
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
30+
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
31+
&& pypy3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
32+
&& rm /tmp/get-pip.py \
33+
; fi \
34+
# 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
35+
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
36+
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
37+
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
38+
# then we use "pip list" to ensure we don't have more than one pip version installed
39+
# https://github.com/docker-library/python/pull/100
40+
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
41+
\
42+
&& rm -rf ~/.cache
2043

2144
CMD ["pypy3"]

3/slim/Dockerfile

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM debian:jessie
22

3-
# remove several traces of debian python
4-
RUN apt-get purge -y python.*
3+
# ensure local pypy is preferred over distribution python
4+
ENV PATH /usr/local/bin:$PATH
55

66
# http://bugs.python.org/issue19846
77
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
@@ -10,19 +10,43 @@ ENV LANG C.UTF-8
1010
RUN apt-get update && apt-get install -y --no-install-recommends \
1111
ca-certificates \
1212
libexpat1 \
13+
libffi6 \
1314
libsqlite3-0 \
1415
&& rm -rf /var/lib/apt/lists/*
1516

1617
ENV PYPY_VERSION 5.2.0-alpha1
18+
ENV PYPY_SHA256SUM f5e66ab24267d6ddf662d07c512d06c10ebc732ae62093dabbd775ac63b9060a
19+
1720
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
1821
ENV PYTHON_PIP_VERSION 8.1.2
1922

20-
RUN set -x \
21-
&& apt-get update && apt-get install -y bzip2 curl --no-install-recommends && rm -rf /var/lib/apt/lists/* \
22-
&& curl -SL "https://bitbucket.org/pypy/pypy/downloads/pypy3.3-v${PYPY_VERSION}-linux64.tar.bz2" \
23-
| tar -xjC /usr/local --strip-components=1 \
24-
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | pypy3 \
25-
&& pip install --upgrade pip==$PYTHON_PIP_VERSION \
26-
&& apt-get purge -y --auto-remove bzip2 curl
23+
RUN set -ex \
24+
&& fetchDeps=' \
25+
bzip2 \
26+
wget \
27+
' \
28+
&& apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
29+
\
30+
&& wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy3.3-v${PYPY_VERSION}-linux64.tar.bz2" \
31+
&& echo "$PYPY_SHA256SUM pypy.tar.bz2" | sha256sum -c \
32+
&& tar -xjC /usr/local --strip-components=1 -f pypy.tar.bz2 \
33+
&& rm pypy.tar.bz2 \
34+
\
35+
# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere
36+
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
37+
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
38+
&& pypy3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
39+
&& rm /tmp/get-pip.py \
40+
; fi \
41+
# 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
42+
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
43+
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
44+
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
45+
# then we use "pip list" to ensure we don't have more than one pip version installed
46+
# https://github.com/docker-library/python/pull/100
47+
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
48+
\
49+
&& apt-get purge -y --auto-remove $fetchDeps \
50+
&& rm -rf ~/.cache
2751

2852
CMD ["pypy3"]

update.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,19 @@ for version in "${versions[@]}"; do
2121
# <td class="name"><a class="execute" href="/pypy/pypy/downloads/pypy3-2.4.0-linux64.tar.bz2">pypy3-2.4.0-linux64.tar.bz2</a></td>
2222
fullVersion="$(curl -sSL 'https://bitbucket.org/pypy/pypy/downloads' | grep -E "$pypy"'-v([0-9.]+(-alpha[0-9]*)?)-linux64.tar.bz2' | sed -r 's/^.*'"$pypy"'-v([0-9.]+(-alpha[0-9]*)?)-linux64.tar.bz2.*$/\1/' | sort -V | tail -1)"
2323

24+
# <p>pypy2.7-5.4.0 sha256:</p>
25+
# <pre class="literal-block">
26+
# ...
27+
# bdfea513d59dcd580970cb6f79f3a250d00191fd46b68133d5327e924ca845f8 pypy2-v5.4.0-linux64.tar.bz2
28+
# ...
29+
# </pre>
30+
sha256sum="$(curl -sSL 'http://pypy.org/download.html' | grep -m1 -E '[a-f0-9]{64} '"$pypy-v$fullVersion"'-linux64.tar.bz2' | cut -d' ' -f1)"
31+
2432
(
2533
set -x
2634
sed -ri '
2735
s/^(ENV PYPY_VERSION) .*/\1 '"$fullVersion"'/;
36+
s/^(ENV PYPY_SHA256SUM) .*/\1 '"$sha256sum"'/;
2837
s/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/;
2938
' "$version"{,/slim}/Dockerfile
3039
sed -ri 's/^(FROM pypy):.*/\1:'"$version"'/' "$version/onbuild/Dockerfile"

0 commit comments

Comments
 (0)