The develop image build broke at `pnpm install --frozen-lockfile`: the new
native dependency re2@1.25.0 (packages/mcp, search_in_page #330) always
compiles from source under pnpm — its prebuilt-binary downloader
(install-artifact-from-github) cannot identify the GitHub repo because pnpm
does not populate npm_package_repository_*/npm_package_json env vars ("No
github repository was identified. Building locally ..."), and node:22-slim
ships no python3/make/g++ for the node-gyp fallback.
- builder stage: add a cache-friendly apt layer with python3 make g++
before COPY; the stage is discarded so the toolchain may stay.
- installer stage: install the toolchain, run the prod install as the node
user via `su node -c`, and purge the toolchain — all in one RUN layer so
the final image stays slim and node_modules ownership needs no extra
chown layer; USER node is restored right after.
Fixes the failed run 28715009124 (develop docker build); release.yml uses
the same Dockerfile and is covered too.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>