You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3ce748f
Browse filesBrowse the repository at this point in the historyBrowse files
docs(images): a RUN in a runtime stage runs emulated on arm64 (MAG-5366)
Both Dockerfiles, the build workflow and CLAUDE.md said a RUN in a runtime
stage fails on arm64 with "exec format error". The zlib upgrade is such a
RUN and the arm64 half of each image built with it: BuildKit's image
carries buildkit-qemu-aarch64 and runs the step under it, in 1.4 s and
2.2 s against 0.4 s and 0.6 s on amd64.
The four places now say what happens and what the rule is for: build work
stays in the build stage because it runs several times slower emulated.
Copy file name to clipboardExpand all lines: CLAUDE.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1241,8 +1241,10 @@ Compose / Makefile knobs:
1241
1241
`$BUILDPLATFORM` (plain-JS output; the api has no native module, and the
1242
1242
web never loads sharp, which `images.unoptimized` in `next.config.mjs`
1243
1243
pins and the web Dockerfile removes from the standalone output) and keeps
1244
-
its runtime stage free of `RUN`, so a `linux/amd64,linux/arm64` build
1245
-
compiles once and the workflow sets up no QEMU. Layers go lockfile +
1244
+
build work out of its runtime stage, so a `linux/amd64,linux/arm64` build
1245
+
compiles once, natively, and the workflow sets up no QEMU. The runtime
1246
+
stage's one `RUN`, the zlib upgrade, runs on arm64 under the emulator
1247
+
BuildKit's image carries, in a second or two. Layers go lockfile +
1246
1248
package manifests → `pnpm install` → sources, so a code-only commit
1247
1249
reuses the install layer. The layer cache lives on GHCR
1248
1250
(`type=registry`): main writes `…/<image>:buildcache`, a branch writes
@@ -1289,6 +1291,6 @@ Compose / Makefile knobs:
1289
1291
| Endpoint URLs |`localhost:<port>` comes from SR_CONFIG's listen ports, gateway hostnames from helm values' `publicUrls` — a mount never has both. Anything that renders or dials an endpoint address must resolve public → local → `—` (`epHttpUrl` / `epWsUrl` in `components/endpoints/bits.tsx`), never hardcode `localhost`. |
1290
1292
| Health words |`HealthState` has exactly four states and exactly one wording — `lib/health.ts` / `<HealthTag>`. A panel that maps health to its own labels/colours is a bug, even when the words look nicer locally: the same upstream is read across panels. |
1291
1293
| BuildKit cache |`make build*` targets use the isolated `srdash-builder` (see Docker / images / isolation). Plain `docker compose up --build` is fine for the stack itself. |
1292
-
|`RUN` in a runtime stage |CI builds the arm64 half of each image without QEMU, so a `RUN` in a Dockerfile's runtime stage fails there with `exec format error`. Do the work in the build stage and `COPY --from=builder`. A runtime break on arm64 (a dependency that loads a native binding at boot) shows up in the `smoke-arm64` job instead. |
1294
+
|`RUN` in a runtime stage |It runs once per architecture, the arm64 one under the emulator BuildKit's image carries (the workflow sets up no QEMU), several times slower than native: `next build` takes about five minutes there against under one. Do build work in the build stage and `COPY --from=builder`; a `RUN` in a runtime stage is for a package step of a second or two, like the zlib upgrade. A runtime break on arm64 (a dependency that loads a native binding at boot) shows up in the `smoke-arm64` job instead. |
1293
1295
| Pinned versions | Every version is exact: package.json, `overrides` in `pnpm-workspace.yaml`, actions by commit SHA, and images by tag plus digest. pnpm is pinned by `packageManager` (CI's `pnpm/setup` reads it; the lockfile's first document records each platform binary's sha512) and by the `ghcr.io/pnpm/pnpm` stage in the three Dockerfiles. A Docker build fails when those two differ (`pnpm_config_pm_on_fail=error`), so move them together. The quality gate's "pins agree" step (`apps/web/scripts/check-pins.mjs`) fails when `.nvmrc` or `packageManager` disagrees with any Dockerfile FROM: Dependabot moves only the Dockerfiles (one PR per image across all three), so its Node or pnpm PR goes green once the same PR moves `.nvmrc` or `packageManager`. It proposes no major of Node, the pnpm image or `@types/node` (`ignore` in `.github/dependabot.yml`); those are migrations done by hand. No corepack: Node 26 does not ship it, and pnpm does not use it. pnpm only reads its settings from `pnpm-workspace.yaml` (the `pnpm` field in package.json and non-auth `.npmrc` keys are ignored), and a package with an install script that is not listed in `allowBuilds` fails the install. There is no minimum release age (`minimumReleaseAge: 0`; Dependabot has no cooldown). `pnpm install` refuses a release published with weaker evidence than the package's earlier releases (`ERR_PNPM_TRUST_DOWNGRADE`). Don't get around that with a `^` range or a `--config` flag: add the package to `trustPolicyExclude` in `pnpm-workspace.yaml` with its reason. A new override or dependency goes in as an exact version, and a new `uses:` or image as a SHA or digest. See README → Testing & CI. |
1294
1296
| Image `files` whitelist | The api image ships only what each package's `files` lists (`apps/api`: `dist`; `packages/db`: `dist` + `migrations`; `packages/shared`: `dist`). A runtime asset anywhere else (a template, a file read with `fs`) works in dev and fails only in the published image — put it under `dist` or add it to `files`. |
0 commit comments