From 21f25610cfc8c980b61cdcb9b42263e41657033c Mon Sep 17 00:00:00 2001 From: wavezhang Date: Mon, 8 Jun 2026 22:59:27 +0800 Subject: [PATCH] feat: build static linux x64 binaries with musl Build codewhale-cli and codewhale-tui with x86_64-unknown-linux-musl target in the CNB tag_push workflow to produce fully static Linux x64 binaries. Install musl-tools instead of libdbus-1-dev; keep toolchain install and build in a single stage since CNB stages run in isolated containers without persistent state. Co-Authored-By: Claude Opus 4.7 --- .cnb.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.cnb.yml b/.cnb.yml index 1a9abfdf..af204c8a 100644 --- a/.cnb.yml +++ b/.cnb.yml @@ -113,20 +113,24 @@ $: - docker: image: rust:1.88-bookworm stages: - - name: build linux x64 release assets + - name: build linux x64 release assets (static) script: | set -eu apt-get update - apt-get install -y git libdbus-1-dev nodejs pkg-config + apt-get install -y git musl-tools nodejs pkg-config + rustup target add x86_64-unknown-linux-musl ./scripts/release/check-versions.sh ./scripts/release/check-ohos-deps.sh - cargo build --release --locked -p codewhale-cli -p codewhale-tui + cargo build --release --locked \ + --target x86_64-unknown-linux-musl \ + -p codewhale-cli -p codewhale-tui mkdir -p target/cnb-release - cp target/release/codewhale target/cnb-release/codewhale-linux-x64 - cp target/release/codewhale-tui target/cnb-release/codewhale-tui-linux-x64 + BIN_DIR="target/x86_64-unknown-linux-musl/release" + cp "$BIN_DIR/codewhale" target/cnb-release/codewhale-linux-x64 + cp "$BIN_DIR/codewhale-tui" target/cnb-release/codewhale-tui-linux-x64 strip \ target/cnb-release/codewhale-linux-x64 \ target/cnb-release/codewhale-tui-linux-x64 \