Skip to content

Instantly share code, notes, and snippets.

@xxxbrian
Last active January 27, 2024 02:06
Show Gist options
  • Save xxxbrian/7d10ba2a553b6854ef3abdead6881790 to your computer and use it in GitHub Desktop.
Save xxxbrian/7d10ba2a553b6854ef3abdead6881790 to your computer and use it in GitHub Desktop.
Cross-Platform Rust Build Script with Docker
# x86_64 Linux
docker run --rm \
--platform=linux/amd64 \
--user "$(id -u)":"$(id -g)" \
-v "$PWD":/usr/src/myapp \
-w /usr/src/myapp \
rust:latest \
cargo build --release --target x86_64-unknown-linux-gnu
# aarch64 Linux
docker run --rm \
--platform=linux/arm64 \
--user "$(id -u)":"$(id -g)" \
-v "$PWD":/usr/src/myapp \
-w /usr/src/myapp \
rust:latest \
cargo build --release --target aarch64-unknown-linux-gnu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment