docker-library/pypy

Alpine images

Closed this issue ยท 13 comments

It would be nice to have image versions based on Alpine Linux, similar to what CPython provides ...

JayH5 commented

The official PyPy builds are not compatible with Alpine Linux. Building PyPy for Alpine Linux from source is a non-trivial task. While you can build CPython from source in a Travis build in ~4 minutes, PyPy takes around 30-60 minutes on a dedicated host. PyPy also needs patching to build on Alpine.

I've managed to get PyPy2 building for Alpine Linux: https://github.com/JayH5/alpine-pypy. Also made some Docker images: https://github.com/JayH5/docker-alpine-pypy. This is half shameless plug/half this may be useful if anybody wants to build PyPy for their Alpine containers.

@JayH5 Could you open a pull request adding your Dockerfiles here under alpine tags?

for comparison, here are resulting image sizes (uncompressed) - the Alpine based PyPy is 1/3 (65MB) smaller than the standard image:

oberstet@thinkpad-t430s:~/scm/3rdparty/docker-alpine-pypy/2/slim$ docker images pypy:2-slim
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
pypy                2-slim              04c79a03c8b4        11 days ago         197MB
oberstet@thinkpad-t430s:~/scm/3rdparty/docker-alpine-pypy/2/slim$ docker images pypy2-alpine-slim
REPOSITORY          TAG                 IMAGE ID            CREATED              SIZE
pypy2-alpine-slim   latest              ae2696d8a9ec        About a minute ago   132MB

The built image works out of the box:

oberstet@thinkpad-t430s:~/scm/3rdparty/docker-alpine-pypy/2/slim$ docker run -it --rm pypy2-alpine-slim
Python 2.7.13 (c925e73810367cd960a32592dd7f728f436c125c, Jun 11 2017, 21:18:06)
[PyPy 5.8.0 with GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>> 

@JayH5 nice job! ah, btw, would be cool to upstream the patches. for pypy2, there seems to be only 1 patch needed for tkinter - looks definitely worth upstreaming. for pypy3, there is a whole bunch though .. mmh.

IMO, ideally, we had Alpine images of PyPy 2 and 3 for all archs x86-64, armhf, aarch64, x86-32, ... because, whatever sw is able to run on top of PyPy could profit from publishing a Docker image for production that includes the sw, and which is based on the Alpine flavor to minimize resource consumption at scale deployments.

The tkinter patch has been upstreamed to pypy: https://bitbucket.org/pypy/pypy/issues/2509/support-alpine-linux

So pypy2-v5.9.0 (to be released shortly) should likely work on Alpine now.

@JayH5 and anyone else, please upstream anything else, particularly for pypy3, needed to the PyPy bitbucket!

JayH5 commented

@pjenvey thanks for the update. That means PyPy2 should build on Alpine now without patches ๐ŸŽ‰

I also saw this commit a while ago that should remove the need for one of the PyPy3 patches.

That being said, unfortunately I personally haven't had and probably won't have the time in the near future to upstream my patches to PyPy. I will try keep my repo up-to-date when a new PyPy release arrives, but I might be a bit slow about that.

Any updates here? Are patches still needed for pypy under alpine, @JayH5?

JayH5 commented

@jmagnusson I haven't tried PyPy 5.10.x yet, but I think PyPy3 will still require patches. PyPy on Alpine Linux also suffers from docker-library/python#211, and I haven't found a way to apply something like docker-library/python#248 to fix it. Sorry, PyPy on Alpine Linux just hasn't been a priority for me recently so I haven't worked on it much.

PyPy 5.10.x is similar to 5.9.0 in that PyPy2 can be built without patches while PyPy3 still requires the same patches.

Unfortunately, until this is something that's officially supported by the PyPy project, it isn't something we reasonably can support (especially given the non-trivial nature of building PyPy from source). I think "it builds successfully" is probably not quite enough here. ๐Ÿ™ˆ

I was hoping I could point to Alpine's own packages for folks who need this, but it appears even they only include PyPy in Alpine Edge: ๐Ÿ˜ฌ

https://pkgs.alpinelinux.org/packages?name=pypy*&branch=edge&arch=x86_64 vs https://pkgs.alpinelinux.org/packages?name=pypy*&branch=v3.15&arch=x86_64

Given this, I'm inclined to close this for now, and revisit once/if we get official released binaries that work on Alpine? ๐Ÿ™ˆ

fwiw, personally, I am not using Alpine anymore, but mostly just a stock/plain Ubuntu for Docker these days, or snaps for embedded, so yeah, given the limits on resources we all have to live with, screw it for now sounds good for me=)

Some update on alpine images/official release?

Pursuant to #5 (comment), I'm going to close this for now:

[We will] revisit once/if we get official released binaries that work on Alpine