I would like to suggest having an official Crystal Alpine docker image available on DockerHub, like Ruby does
I found this unofficial image, which seems to work, but it would be nice to have something more formal.
Also, as a side note - I am not sure what are the minimum requirements by DockerHub to become an official library repository, but it would be nice if Crystal is accepted as an official library repo, rather than a repo of the “crystallang” user. So we can FROM crystal:alpine in our Dockerfiles.
Yes, we should provide an official Alpine image.
The thing is, it should not depend on the Crystal package in aports to avoid release delays. So we need to build it ourselves, which technically is not an issue, but the details of making it ready for distribution.
The heaviest package by far is gcc. We obviously don’t need the entire compiler collection. But it provides the linker. I don’t know if there are any alternatives with less baggage.
I tried to start splitting the libstdc++-dev from the gcc package, without success https://github.com/alpinelinux/aports/pull/9517 (needed for static linking). There are current limitations on the Alpine package build system.
Maybe a (separate?) multi-stage Docker build? (e.g.: one for ‘crystal-compiler’ w/ all the parts for those who need it and one for ‘crystal-binary’ w/ bare minimum to use for those who just need the bin file)
There are already separate images: crystallang/crystal:0.32.1-alpine and crystallang/crystal:0.32.1-alpine-build. The latter contains additional dependencies for building the crystal compiler and is usually not required unless you’re building the compiler. The former is almost the bare minimum for everyone just using the compiler to build their code. There are a few dependencies for stdlib libraries included which are not necessary in 100% of use cases but are very common (such as libyaml for example). They’re also pretty light-weight, so not to worry about.