Skip to content

Bring up to equivalent quality as Python images #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 28 additions & 8 deletions 2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,41 @@
FROM buildpack-deps:jessie

# remove several traces of debian python
RUN apt-get purge -y python.*
# ensure local pypy 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

ENV PYPY_VERSION 5.4.1
# runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
tcl \
tk \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I'm not installing these in the slim images, as the same is not done in the Python slim images.

You can check for the necessary libraries doing something like:

find /usr/local -type f -iname '*.so' | xargs ldd | grep 'not found'

On the non-slim Python/PyPy images this returns nothing. On the slim PyPy images this returns:

        libtcl8.6.so => not found
        libtk8.6.so => not found
        libgdbm.so.3 => not found

On the slim Python images it returns:

        libtk8.6.so => not found
        libtcl8.6.so => not found
        libX11.so.6 => not found

Not sure if missing gdbm is an issue...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could open a new issue to research the missing libgdbm to see if it is a problem. It is missing from the current slim images as well, so it is unrelated to your changes.

&& rm -rf /var/lib/apt/lists/*

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

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 8.1.2
RUN curl -SL 'https://bootstrap.pypa.io/get-pip.py' | pypy \
&& pip install --upgrade pip==$PYTHON_PIP_VERSION

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 \
\
&& 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 -rf ~/.cache

CMD ["pypy"]
39 changes: 30 additions & 9 deletions 2/slim/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM debian:jessie

# remove several traces of debian python
RUN apt-get purge -y python.*
# ensure local pypy 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.
Expand All @@ -10,19 +10,40 @@ ENV LANG C.UTF-8
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libexpat1 \
libffi6 \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*

ENV PYPY_VERSION 5.4.1
ENV PYPY_SHA256SUM 9c85319778224d7fb0c348f55fe3fada15bb579c5f3870a13ad63b42a737dd72

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 8.1.2

RUN set -x \
&& apt-get update && apt-get install -y bzip2 curl --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SL "https://bitbucket.org/pypy/pypy/downloads/pypy2-v${PYPY_VERSION}-linux64.tar.bz2" \
| tar -xjC /usr/local --strip-components=1 \
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | pypy \
&& pip install --upgrade pip==$PYTHON_PIP_VERSION \
&& apt-get purge -y --auto-remove bzip2 curl
RUN set -ex \
&& fetchDeps=' \
bzip2 \
wget \
' \
&& 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 /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" ] \
\
&& apt-get purge -y --auto-remove $fetchDeps \
&& rm -rf ~/.cache

CMD ["pypy"]
39 changes: 31 additions & 8 deletions 3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
FROM buildpack-deps:jessie

# remove several traces of debian python
RUN apt-get purge -y python.*
# ensure local pypy 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

ENV PYPY_VERSION 5.2.0-alpha1
# runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
tcl \
tk \
&& rm -rf /var/lib/apt/lists/*

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

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 8.1.2
RUN curl -SL 'https://bootstrap.pypa.io/get-pip.py' | pypy3 \
&& pip install --upgrade pip==$PYTHON_PIP_VERSION

RUN set -ex \
&& wget -O pypy.tar.bz2 "https://bitbucket.org/pypy/pypy/downloads/pypy3.3-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 \
\
# 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 -rf ~/.cache

CMD ["pypy3"]
42 changes: 33 additions & 9 deletions 3/slim/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM debian:jessie

# remove several traces of debian python
RUN apt-get purge -y python.*
# ensure local pypy 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.
Expand All @@ -10,19 +10,43 @@ ENV LANG C.UTF-8
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libexpat1 \
libffi6 \
libsqlite3-0 \
&& rm -rf /var/lib/apt/lists/*

ENV PYPY_VERSION 5.2.0-alpha1
ENV PYPY_SHA256SUM f5e66ab24267d6ddf662d07c512d06c10ebc732ae62093dabbd775ac63b9060a

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 8.1.2

RUN set -x \
&& apt-get update && apt-get install -y bzip2 curl --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SL "https://bitbucket.org/pypy/pypy/downloads/pypy3.3-v${PYPY_VERSION}-linux64.tar.bz2" \
| tar -xjC /usr/local --strip-components=1 \
&& curl -SL 'https://bootstrap.pypa.io/get-pip.py' | pypy3 \
&& pip install --upgrade pip==$PYTHON_PIP_VERSION \
&& apt-get purge -y --auto-remove bzip2 curl
RUN set -ex \
&& fetchDeps=' \
bzip2 \
wget \
' \
&& 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.3-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 \
\
# 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" ] \
\
&& apt-get purge -y --auto-remove $fetchDeps \
&& rm -rf ~/.cache

CMD ["pypy3"]
9 changes: 9 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ for version in "${versions[@]}"; do
# <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>
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)"

# <p>pypy2.7-5.4.0 sha256:</p>
# <pre class="literal-block">
# ...
# bdfea513d59dcd580970cb6f79f3a250d00191fd46b68133d5327e924ca845f8 pypy2-v5.4.0-linux64.tar.bz2
# ...
# </pre>
sha256sum="$(curl -sSL 'http://pypy.org/download.html' | grep -m1 -E '[a-f0-9]{64} '"$pypy-v$fullVersion"'-linux64.tar.bz2' | cut -d' ' -f1)"

(
set -x
sed -ri '
s/^(ENV PYPY_VERSION) .*/\1 '"$fullVersion"'/;
s/^(ENV PYPY_SHA256SUM) .*/\1 '"$sha256sum"'/;
s/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/;
' "$version"{,/slim}/Dockerfile
sed -ri 's/^(FROM pypy):.*/\1:'"$version"'/' "$version/onbuild/Dockerfile"
Expand Down