Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork76
Docker images for compiling static Rust binaries using musl-cross
License
MIT and 2 other licenses found
Licenses found
rust-cross/rust-musl-cross
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
🚀 Help me to become a full-time open-source developer bysponsoring me on GitHub
Docker images for compiling static Rust binaries usingmusl-cross-make,inspired byrust-musl-builder
Currently we have the followingprebuilt Docker images on Docker Hub,supports x86_64(amd64) and aarch64(arm64) architectures.
Rust toolchain | Cross Compile Target | Docker Image Tag |
---|---|---|
stable | aarch64-unknown-linux-musl | aarch64-musl |
stable | arm-unknown-linux-musleabi | arm-musleabi |
stable | arm-unknown-linux-musleabihf | arm-musleabihf |
stable | armv5te-unknown-linux-musleabi | armv5te-musleabi |
stable | armv7-unknown-linux-musleabi | armv7-musleabi |
stable | armv7-unknown-linux-musleabihf | armv7-musleabihf |
stable | i586-unknown-linux-musl | i586-musl |
stable | i686-unknown-linux-musl | i686-musl |
stable | mips-unknown-linux-musl | mips-musl |
stable | mipsel-unknown-linux-musl | mipsel-musl |
stable | mips64-unknown-linux-muslabi64 | mips64-muslabi64 |
stable | mips64el-unknown-linux-muslabi64 | mips64el-muslabi64 |
stable | powerpc64le-unknown-linux-musl | powerpc64le-musl |
stable | riscv64gc-unknown-linux-musl | riscv64gc-musl |
stable | x86_64-unknown-linux-musl | x86_64-musl |
To usearmv7-unknown-linux-musleabihf
target for example, first pull the image:
docker pull ghcr.io/rust-cross/rust-musl-cross:armv7-musleabihf# Also available on Docker Hub# docker pull messense/rust-musl-cross:armv7-musleabihf
Then you can do:
alias rust-musl-builder='docker run --rm -it -v "$(pwd)":/home/rust/src ghcr.io/rust-cross/rust-musl-cross:armv7-musleabihf'rust-musl-builder cargo build --release
This command assumes that$(pwd)
is readable and writable. It will output binaries inarmv7-unknown-linux-musleabihf
.At the moment, it doesn't attempt to cache libraries between builds, so this is best reserved for making final release builds.
rust-musl-cross
usesmusl-libc,musl-gcc with the help ofmusl-cross-make to make it easy to compile, and the newrustuptarget
support.
Currently we install stable Rust by default, if you want to switch to beta/nightly Rust, you can do it by extendingfrom our Docker image, for example to use beta Rust for targetx86_64-unknown-linux-musl
:
FROM ghcr.io/rust-cross/rust-musl-cross:x86_64-muslRUN rustup update beta && \ rustup target add --toolchain beta x86_64-unknown-linux-musl
You can use themusl-strip
command inside the image to strip binaries, for example:
docker run --rm -it -v"$(pwd)":/home/rust/src ghcr.io/rust-cross/rust-musl-cross:armv7-musleabihf musl-strip /home/rust/src/target/release/example
Licensed underThe MIT License
About
Docker images for compiling static Rust binaries using musl-cross
Topics
Resources
License
MIT and 2 other licenses found
Licenses found
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.