Docker images used to build PyPy for Alpine Linux (https://github.com/JayH5/alpine-pypy)
5.9K
Docker-based builds for PyPy on Alpine Linux.
These are unofficial builds maintained by one person who hasn't yet figured out how to automate builds that take 1hr+ on dedicated VMs without spending lots of money. For downloads, see the releases page. For the Docker images used to build PyPy see this Docker Hub page. For Docker images that use these PyPy builds, see the JayH5/docker-alpine-pypy repository.
Currently, PyPy is only built for glibc/GNU-based Linux distributions, namely, Debian and Ubuntu. Recently, the Alpine Linux distribution has been gaining in popularity as a base OS for containers, due to its small size and container-friendly tools. A big way that Alpine achieves its small size is through its use of musl as its C standard library and BusyBox as its set of Unix tools. This means that PyPy binaries compiled for glibc/GNU are not compatible with Alpine Linux.
This repository seeks to make it easy to build PyPy for Alpine Linux.
Docker images are provided for building PyPy:
alpine-pypy-build:2-bootstrap: An image to build PyPy from source using cPython.alpine-pypy-build:2: An image to build PyPy from source using an existing PyPy binary.PyPy requires a Python implementation in order to build itself. The recommended implementation to use is PyPy itself as it is much faster than standard cPython. But if you don't have a PyPy binary in the first place you'll have to settle for cPython.
The first step is to get the bootstrap image which you can either build from source or pull from Docker Hub:
docker build -t alpine-pypy-build:2-bootstrap -f 2/bootstrap.dockerfile 2
or..
docker pull jamiehewland/alpine-pypy-build:2-bootstrap
Then things should be as simple as running the container with a mounted volume:
docker run --rm -it -v "$(pwd)/tmp:/tmp" jamiehewland/alpine-pypy-build:2-bootstrap
Unless you have a really fast computer this will take several hours. As the PyPy people say: Enjoy Mandelbrot :-).
Once this is all done, the built PyPy package should be at ./tmp/usession-release-$PYPY_VERSION-1/build on the container host. $PYPY_VERSION is defined in the Dockerfile, but it's also possible to override the version that PyPy is packaged as by setting the $PYPY_RELEASE_VERSION environment variable.
PyPy compiles several times faster using itself rather than cPython. In general, we can use older versions of PyPy to build newer ones. The PyPy builder is based on the non-builder image.
docker run --rm -it -v "$(pwd)/tmp:/tmp" jamiehewland/alpine-pypy-build:2
There are a few workarounds for differences between Alpine Linux and the Debian-based Linux distributions that the PyPy team has thus far worked against.
alpine-pypy-build:2-bootstrap image is based on the python:2-alpine Docker image which instead builds Python from source.PYPY_PACKAGE_WITHOUTTK environment variable to any value.tar running on Linux supports the --owner and --group flags -- BusyBox's does not. We simply sed out those flags in the script :-/.Content type
Image
Digest
Size
108 MB
Last updated
over 6 years ago
docker pull jamiehewland/alpine-pypy-build:2.7-7.3.1-alpine3.11