Skip to content

fix(docker): build Next.js images with Node 22 - #361

Merged
zjy365 merged 1 commit into
mainfrom
codex/fix-next-docker-build-runtime
Oct 13, 2026
Merged

zjy365 merged 1 commit into
mainfrom
codex/fix-next-docker-build-runtime

Conversation

@zjy365

@zjy365 zjy365 commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

After upgrading to Next.js 16.3.6, the UI and registry images compile and typecheck but crash when collecting page data. Their builders only contain Bun 1.3.5: node resolves to Bun's fallback, and the Next.js production page runtime fails with Expected CommonJS module to have a function wrapper before Bun exits with code 132. Local builds with a real Node executable did not exercise this path.

Copy the Node 22 binary into both builders and explicitly invoke the Next CLI with it, matching the production runner's Node major. Bun 1.3.5 still installs the frozen workspace. Also run the existing Docker matrix on PRs that change Next.js dependency/build inputs; PR builds skip registry login and image publication so these failures are caught before merge.

Validation:

  • Red/green on linux/amd64: the original registry Dockerfile reproduces the CI crash and exit 132; both updated Dockerfiles build complete images successfully.
  • Both images contain Next.js 16.3.6 and run on Node 22.
  • Registry container: homepage and dynamic component-preview route return HTTP 200.
  • UI container: homepage returns HTTP 200 with the expected streamed /project redirect, using dummy startup configuration and no external services or database.
  • bun typecheck, bun check, bun lint, and actionlint pass.

Failure reference: https://github.com/labring/brain/actions/runs/38388805596

Bun-only builders executed Next.js through the node-to-Bun fallback, which crashes loading the Next.js 16.3.6 production page runtime. Copy the real Node 22 binary into both builders and invoke Next explicitly with it. Keep Bun 1.3.5 for frozen dependency installs.

Build Docker images on pull requests that change the Next.js build inputs, without publishing, so runtime incompatibilities are caught before merge.
@zjy365
zjy365 merged commit aa80bd2 into main Oct 13, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant