* Resolves the Docker `--platform` for this host and enforces the constraints * that come with it — keeping that policy out of `renderDocker` so the * orchestrator stays focused on build/run wiring. May terminate the process * via errorBox on unrecoverable mismatches (e.g. --gpu on arm64).
(options: RenderOptions)
| 1198 | * via errorBox on unrecoverable mismatches (e.g. --gpu on arm64). |
| 1199 | */ |
| 1200 | function resolveDockerHostPlatform(options: RenderOptions): string { |
| 1201 | const platform = resolveDockerPlatform(); |
| 1202 | |
| 1203 | // Docker Desktop on Apple Silicon (and colima with VZ) doesn't implement |
| 1204 | // the `--gpus` host-passthrough flag, so requesting `--gpu` on a linux/arm64 |
| 1205 | // container fails at `docker run` with an opaque device-driver error. Catch |
| 1206 | // it early with actionable guidance. |
| 1207 | if (options.gpu && platform === "linux/arm64") { |
| 1208 | errorBox( |
| 1209 | "--gpu is not supported with --docker on arm64 hosts", |
| 1210 | "Docker Desktop/colima on Apple Silicon doesn't expose --gpus host passthrough to linux/arm64 containers.", |
| 1211 | "Drop --gpu, or run a native (non-Docker) render on this host, or set HYPERFRAMES_DOCKER_PLATFORM=linux/amd64 if you need GPU encoding (slow under qemu but works).", |
| 1212 | ); |
| 1213 | process.exit(1); |
| 1214 | } |
| 1215 | |
| 1216 | if (!options.quiet && platform === "linux/arm64") { |
| 1217 | // chrome-headless-shell doesn't publish a linux-arm64 build, so the arm64 |
| 1218 | // image falls back to system chromium. That loses byte-for-byte parity |
| 1219 | // with amd64 renders — fine for end-user output, not fine if you're |
| 1220 | // comparing against an amd64 golden baseline. Set |
| 1221 | // HYPERFRAMES_DOCKER_PLATFORM=linux/amd64 to keep parity (qemu-emulated, |
| 1222 | // slower). |
| 1223 | console.log( |
| 1224 | c.dim( |
| 1225 | " Host is arm64 — using linux/arm64 image with system chromium " + |
| 1226 | "(output won't be byte-identical to amd64 renders; " + |
| 1227 | "set HYPERFRAMES_DOCKER_PLATFORM=linux/amd64 to force parity).", |
| 1228 | ), |
| 1229 | ); |
| 1230 | } |
| 1231 | |
| 1232 | return platform; |
| 1233 | } |
| 1234 | |
| 1235 | // Inherited minor finding (CRAP 37.1, cyclomatic 11). This PR only added |
| 1236 | // `pageNavigationTimeoutMs` to the options forwarded to `buildDockerRunArgs`. |
no test coverage detected