mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
279eea9799
commit
f91b8cfeb1
1 changed files with 9 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue