Linux musl cross toolchain Docker images, built with musl-cross-make. The toolchain binaries are statically linked.
The images are volume-only scratch images, and have no OS.
A few docker images have been published to Bitshock docker hub:
bitshock/x86_64-linux-muslforlinux/amd64andlinux/arm64platformsbitshock/aarch64-linux-muslforlinux/amd64andlinux/arm64platforms
To target x86_64-linux-musl:
FROM bitshock/x86_64-linux-musl:latest AS musl
FROM alpine:latest AS builder
COPY --from=musl /musl /opt/x86_64-linux-musl
RUN export PATH=/opt/x86_64-linux-musl/bin:$PATH
To target aarch64-linux-musl:
FROM bitshock/aarch64-linux-musl:latest AS musl
FROM alpine:latest AS builder
COPY --from=musl /musl /opt/aarch64-linux-musl
RUN export PATH=/opt/aarch64-linux-musl/bin:$PATH
Set the TARGET build arg to target the musl target. See musl-cross-make for a list of available targets.
Use --platform to set the compiler host architecture.
Example:
docker buildx build --platform linux/amd64,linux/arm64 --build-arg TARGET=x86_64-linux-musl --load -t x86_64-linux-musl .