chore(partnerctl): add GraalVM native-image setup and arm64 build tooling

This commit is contained in:
2026-05-03 15:46:26 +08:00
parent d2c3416f48
commit cbdb33fefe
3 changed files with 112 additions and 1 deletions

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail
MODULE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
REPO_DIR="$(cd "${MODULE_DIR}/.." && pwd)"
IMAGE_NAME="${PARTNERCTL_ARM64_BUILDER_IMAGE:-partnerctl-native-arm64-builder:21}"
DOCKERFILE="${MODULE_DIR}/Dockerfile.native-arm64"
if ! docker image inspect "${IMAGE_NAME}" >/dev/null 2>&1; then
echo "[partnerctl] building reusable arm64 native builder image: ${IMAGE_NAME}"
docker buildx build \
--platform linux/arm64 \
-f "${DOCKERFILE}" \
-t "${IMAGE_NAME}" \
--load \
"${MODULE_DIR}"
fi
echo "[partnerctl] building linux-aarch64 native executable"
docker run --rm \
--platform linux/arm64 \
--entrypoint /bin/bash \
-v "${REPO_DIR}":/workspace \
-v "${HOME}/.m2":/root/.m2 \
-w /workspace/PartnerCtl \
"${IMAGE_NAME}" \
-lc 'mvn -Pnative native:compile && file target/partnerctl'