diff --git a/docker/Dockerfile b/docker/Dockerfile index 240597b51..c00b232d9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,7 @@ -FROM node:22-alpine AS build +# The Nx builds below emit platform-independent JS/static assets. During +# multi-arch publish builds, keep that heavy build stage on the native builder +# platform instead of running Node/Nx through QEMU for linux/arm64. +FROM --platform=$BUILDPLATFORM node:22-alpine AS build RUN apk add --no-cache python3 make g++ git diff --git a/docker/README.md b/docker/README.md index 30e49b150..1c4876d22 100644 --- a/docker/README.md +++ b/docker/README.md @@ -49,6 +49,12 @@ pnpm nx build web --configuration=pwa pnpm nx build web-backend ``` +Those Nx builds generate platform-independent JS and static assets. In +multi-architecture CI builds, the Dockerfile runs this build stage on the native +BuildKit builder platform, then copies the generated output into each target +runtime image. That avoids running the Angular/Nx build through QEMU when +publishing `linux/amd64` and `linux/arm64` images. + ## Published Docker Tags Pull request builds validate the Dockerfile without pushing an image. Docker