Fix multi-arch Docker build SIGILL by splitting frontend stage#36646
Conversation
Build frontend assets on the native platform ($BUILDPLATFORM) in a separate stage to avoid running esbuild/webpack under QEMU emulation, which causes SIGILL on arm64/riscv64. Frontend assets (JS/CSS/fonts) are platform-independent and only need to be built once. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
This fixes the persistent build issue with |
|
Example of the SIGILL failure: https://github.com/go-gitea/gitea/actions/runs/22049014112/job/63703196222 |
There was a problem hiding this comment.
Pull request overview
This pull request fixes multi-architecture Docker build failures by splitting the build process into two stages: a frontend build stage that runs on the native platform and a backend build stage that runs on each target architecture. This change addresses SIGILL crashes caused by running esbuild under QEMU emulation when building for arm64 and riscv64.
Changes:
- Split Dockerfile into frontend-build and build-env stages, with frontend running on $BUILDPLATFORM
- Removed nodejs/pnpm dependencies from backend build stage since they're no longer needed
- Changed backend stage to run
make backendinstead ofmaketo avoid attempting frontend rebuild - Applied identical changes to both Dockerfile and Dockerfile.rootless for consistency
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Dockerfile | Added frontend-build stage on native platform; backend stage now copies frontend assets and only builds Go binary |
| Dockerfile.rootless | Identical split-stage changes as Dockerfile, maintaining consistency for rootless builds |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Assuming dryrun completes, this should be ready. |
Address review feedback: add comment explaining why COPY is used instead of bind mount in Dockerfile, and restore the cross-reference comment in Dockerfile.rootless. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
FYI, This branch results in a roughly 9% speed up of the |
TheFox0x7
left a comment
There was a problem hiding this comment.
I've tested it - image builds properly, there's no size difference and it starts as before so I see no issues.
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com> Signed-off-by: silverwind <me@silverwind.io>
|
Very useful improvement. ps: I was trying to look for something like |
|
Yeah something to eliminate the duplication would be nice. |
|
Podman has support for cpp preprocessing so you could have |
Summary
$BUILDPLATFORM) then copied to the per-architecture backend build stagebuild-envstage no longer needsnodejs/pnpmsince it only builds the Go backendContext
The
docker-dryrunCI has been failing with 100% rate whenever the container job is triggered because esbuild's native arm64 binary crashes under QEMU user-mode emulation. This is a known class of issues (evanw/esbuild#3153, docker/buildx#2028). The previous Dockerfile had a TODO comment anticipating this fix.Test plan
docker-dryrunCI passes (container job)🤖 Generated with Claude Code