From 90669731f0b86672bc1439855805402f64e22623 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Thu, 16 May 2024 14:46:44 -0700 Subject: [PATCH] build: Produce statically-linked images with musl (#440) --- .github/workflows/release.yml | 8 +------- justfile | 10 ++++------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9197001..b4b72ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,16 +58,10 @@ jobs: PACKAGE_VERSION: ${{ needs.meta.outputs.version }} CARGO_RELEASE: "1" DEBIAN_FRONTEND: noninteractive - container: docker://ghcr.io/linkerd/dev:v43-rust + container: docker://ghcr.io/linkerd/dev:v43-rust-musl steps: - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - run: git config --global --add safe.directory "$PWD" # actions/runner#2033 - - run: just rustup - if: matrix.arch != 'amd64' - - run: apt-get update && apt-get install -y g++-aarch64-linux-gnu gcc-aarch64-linux-gnu libc6-dev-arm64-cross - if: matrix.arch == 'arm64' - - run: apt-get update && apt-get install -y g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf libc6-dev-armhf-cross - if: matrix.arch == 'arm' - run: just release - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 with: diff --git a/justfile b/justfile index fa792fd..bd392f5 100644 --- a/justfile +++ b/justfile @@ -21,11 +21,11 @@ package_arch := env_var_or_default("ARCH", "amd64") # If a `package_arch` is specified, then we change the default cargo `--target` # to support cross-compilation. Otherwise, we use `rustup` to find the default. _cargo_target := if package_arch == "amd64" { - "x86_64-unknown-linux-gnu" + "x86_64-unknown-linux-musl" } else if package_arch == "arm64" { - "aarch64-unknown-linux-gnu" + "aarch64-unknown-linux-musl" } else if package_arch == "arm" { - "armv7-unknown-linux-gnueabihf" + "armv7-unknown-linux-musleabihf" } else { `rustup show | sed -n 's/^Default host: \(.*\)/\1/p'` } @@ -149,9 +149,7 @@ test *flags: # Build linkerd-await build: - {{ _cargo }} build --frozen --target={{ _cargo_target }} \ - {{ if build_type == "release" { "--release" } else { "" } }} \ - {{ _fmt }} + just-cargo profile={{ build_type }} target={{ _cargo_target }} build release: fetch build @mkdir -p release