Interesting approach @zw963, I鈥檓 currently using my own dev container to build these static binaries:
- Dev Container: GitHub - luislavena/hydrofoil-crystal: Opinionated, Alpine-based development container for Crystal
- Example: GitHub - luislavena/exp-crystal-hello-binary: 馃И Compile and package static binaries with Crystal
It uses docker run
directly (exp-crystal-hello-binary/build.yml at main 路 luislavena/exp-crystal-hello-binary 路 GitHub) since I鈥檓 going to publish multi-arch container images soon (both amd64 and arm64).
Then using Docker QEMU support you can docker run --platform linux/arm64
all on the same host.
I鈥檓 also working on getting static binaries for macOS (both x86_64 and arm64), that鈥檚 a bit challenging as requires the dependencies be statically compiled as well, but not impossible:
The binary is cross-compiled using zig cc
and linked against the static libraries generated previously.
(I know, using another language as toolchain, but seems I鈥檓 not the only one)
Happy to see others interested in getting the static binaries of their Crystal programs!