Skip to content

A Docker image preconfigured to build static musl-based binaries from Rust

License

Notifications You must be signed in to change notification settings

esposm03/rust-musl-cross-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rust-musl-cross-docker

A Docker image with necessary dependencies to build static cross-compiled binaries for musl from Rust

How to use

In your project, create a .cargo/config.toml file with this content:

[target.x86_64-unknown-linux-musl]
linker = "x86_64-linux-gnu-gcc"
rustflags = ["-Clink-self-contained=yes"]

[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-gnu-gcc"
rustflags = ["-Clink-self-contained=yes"]

Then, you can build the project with docker run --rm -it -v .:/build -v $HOME/.cargo/registry:/usr/local/cargo/registry ghcr.io/esposm03/rust-musl-cross-docker <build command>, where the build command is usually something like cargo build --release --target x86_64-unknown-linux-gnu.

About

A Docker image preconfigured to build static musl-based binaries from Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages