From f91b8cfeb1261ce0dbd21aa63fe05c288a90c01f Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Tue, 27 Jan 2026 06:32:47 +1100 Subject: [PATCH] feat: support ARM64 hosts in cross-compiler Docker image Add TARGETARCH detection to download the correct Zig binary for the host architecture (aarch64 vs x86_64). This enables native performance on Apple Silicon Macs instead of requiring emulation. Co-Authored-By: Claude Opus 4.5 --- .../commands/build_assets/docker/Dockerfile.cross | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/v3/internal/commands/build_assets/docker/Dockerfile.cross b/v3/internal/commands/build_assets/docker/Dockerfile.cross index 474c05525..dc4c9602f 100644 --- a/v3/internal/commands/build_assets/docker/Dockerfile.cross +++ b/v3/internal/commands/build_assets/docker/Dockerfile.cross @@ -1,6 +1,7 @@ # Cross-compile Wails v3 apps to any platform # # Uses Zig as C compiler + macOS SDK for darwin targets +# Supports both amd64 and arm64 host architectures # # Usage: # docker build -t wails-cross -f Dockerfile.cross . @@ -10,16 +11,21 @@ # docker run --rm -v $(pwd):/app wails-cross linux arm64 # docker run --rm -v $(pwd):/app wails-cross windows amd64 # docker run --rm -v $(pwd):/app wails-cross windows arm64 +# +# Multi-arch build: +# docker buildx build --platform linux/amd64,linux/arm64 -t wails-cross -f Dockerfile.cross . FROM golang:1.25-alpine RUN apk add --no-cache curl xz nodejs npm -# Install Zig +# Install Zig - automatically selects correct binary for host architecture ARG ZIG_VERSION=0.14.0 -RUN curl -L "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz" \ +ARG TARGETARCH +RUN ZIG_ARCH=$(case "${TARGETARCH}" in arm64) echo "aarch64" ;; *) echo "x86_64" ;; esac) && \ + curl -L "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-${ZIG_ARCH}-${ZIG_VERSION}.tar.xz" \ | tar -xJ -C /opt \ - && ln -s /opt/zig-linux-x86_64-${ZIG_VERSION}/zig /usr/local/bin/zig + && ln -s /opt/zig-linux-${ZIG_ARCH}-${ZIG_VERSION}/zig /usr/local/bin/zig # Download macOS SDK (required for darwin targets) ARG MACOS_SDK_VERSION=14.5