build-build-image.sh (1139B)
1 #!/bin/sh 2 3 set -ex 4 5 ARCH=$1 6 TOOLCHAIN=1.76.0 7 if [ "$ARCH" = arm64 ]; then 8 TARGET=aarch64-unknown-linux-musl 9 # there's no aarch64-linux-musl-gcc, use the gnu one 10 CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc 11 CC=aarch64-linux-gnu-gcc 12 export CC CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER 13 else 14 TARGET=x86_64-unknown-linux-musl 15 fi 16 17 # Install our Rust toolchain and the `musl` target. We patch the 18 # command-line we pass to the installer so that it won't attempt to 19 # interact with the user or fool around with TTYs. We also set the default 20 # `--target` to musl so that our users don't need to keep overriding it 21 # manually. 22 curl https://sh.rustup.rs -sSf | \ 23 sh -s -- -y \ 24 --profile minimal \ 25 --default-toolchain $TOOLCHAIN \ 26 --target $TARGET 27 28 # Set up our path with all our binary directories, including those for the 29 # musl-gcc toolchain and for our Rust toolchain. 30 export PATH="/home/rust/.cargo/bin:$PATH" 31 32 # --out-dir is not yet stable 33 export RUSTC_BOOTSTRAP=1 34 # Build our application. 35 cargo build --target $TARGET --out-dir=bin --release -Zunstable-options