From 1a1507dd51466ba5b75afb2af5303d965533408c Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 27 Jul 2025 03:00:57 +0000 Subject: [PATCH] Fix cross-compilation of container images --- appveyor.yml | 3 +-- build-single.sh | 10 +++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 2f41a78..5b810fa 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,8 +13,7 @@ environment: install: - sh: 'sudo apt update || true' - - sh: 'sudo apt install -y qemu binfmt-support qemu-user-static' - - sh: 'docker run --rm --privileged multiarch/qemu-user-static --reset -p yes' + - sh: 'docker run --privileged --rm tonistiigi/binfmt --install all' before_build: - sh: 'git submodule update --init --recursive' diff --git a/build-single.sh b/build-single.sh index df64ccb..9ba790c 100755 --- a/build-single.sh +++ b/build-single.sh @@ -1,6 +1,14 @@ TARGET_NAME="$1-$2" DOCKERFILE="Dockerfile.$1.$2" +if [ "$1" == "aarch64" ] || [ "$1" == "rpi64" ] || [ "$1" == "l4t" ]; then + DOCKER_DEFAULT_PLATFORM="linux/arm64" +elif [ "$1" == "armhf" ] || [ "$1" == "rpi" ]; then + DOCKER_DEFAULT_PLATFORM="linux/arm/v7" +elif [ "$1" == "riscv64" ]; then + DOCKER_DEFAULT_PLATFORM="linux/riscv64" +fi + TAG_UNIQUE_ID=`(git ls-tree HEAD; git diff-index HEAD) | sha256sum | cut -c-16` TAG_NAME="${TARGET_NAME}_${TAG_UNIQUE_ID}" OUT_DIR="out_$TARGET_NAME" @@ -17,7 +25,7 @@ if [ $PULL_EXIT_CODE -eq 0 ]; then echo Using pre-built Docker image - cgutman/moonlight-packaging:$TAG_NAME else echo Pre-built image not available - building cgutman/moonlight-packaging:$TAG_NAME - docker build --pull -f $DOCKERFILE -t cgutman/moonlight-packaging:$TAG_NAME . + docker buildx build --pull -f $DOCKERFILE -t cgutman/moonlight-packaging:$TAG_NAME . echo Built Docker image - cgutman/moonlight-packaging:$TAG_NAME fi