diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml index 41950c3..25f73be 100644 --- a/.gitea/workflows/docker.yml +++ b/.gitea/workflows/docker.yml @@ -67,12 +67,14 @@ jobs: - name: Checkout code uses: actions/checkout@v6 - # The runner is an arm64 server, so the amd64 image is emulated. On its 6.8 kernel, recent - # QEMU builds segfault compiling PHP extensions (docker/buildx#3170); QEMU 8 is pinned. + # The runner is an arm64 server, so the amd64 image's final stage is emulated. QEMU 8.x + # crashes running x86_64 programs on an arm64 host (QEMU issue 2168, "QEMU internal + # SIGSEGV {code=MAPERR, addr=0x20}") and 10.2 segfaults on this runner too; 9.2.2 was + # checked on the runner's host: node, composer and install-php-extensions all run. - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: - image: tonistiigi/binfmt:qemu-v8.1.5 + image: tonistiigi/binfmt:qemu-v9.2.2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 diff --git a/Dockerfile b/Dockerfile index d8c022a..8c7670b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ # ============================================ # Stage 1: Install PHP dependencies # ============================================ -FROM composer:2 AS vendor +# Built on the build machine's own platform: vendor/ is plain PHP, the same for every target, so a +# multi-arch build runs it once and never under emulation. +FROM --platform=$BUILDPLATFORM composer:2 AS vendor WORKDIR /app @@ -21,8 +23,9 @@ RUN composer dump-autoload --optimize --no-dev # ============================================ # Stage 2: Build frontend assets # ============================================ -# After Composer: the stylesheet and script import Livewire Material from vendor/. -FROM node:24-alpine AS assets +# After Composer: the stylesheet and script import Livewire Material from vendor/. On the build +# machine's platform too: the output is CSS and JavaScript, whatever the target. +FROM --platform=$BUILDPLATFORM node:24-alpine AS assets WORKDIR /app