Dockerfile Generation (Next.js or Hono)
Generate one Dockerfile per project. Detect the stack (Next.js or Hono) and output the matching variant:
| Stack | Output image | Reference |
|---|---|---|
| Next.js | Node.js image with Next.js build | nextjs.md |
| Hono | Node.js image with rolldown/vite build | hono.md |
Do not combine both stacks in one Dockerfile. If the app is Next.js, follow nextjs.md only; if Hono, follow hono.md only.
Package manager
Use pnpm when possible, not npm. Prefer pnpm unless the project has no pnpm-lock.yaml (or equivalent) and explicitly uses npm.
- •In the Dockerfile base image, enable pnpm via Corepack:
RUN corepack enable pnpm(Node 16.9+). - •Install deps:
pnpm install --frozen-lockfile(orpnpm ciwhere available). - •Run scripts:
pnpm run build,pnpm run start, etc.
Workflow checklist
When generating a Dockerfile:
- •Detect stack: Is the app Next.js (e.g.
nextin deps,next.config.*) or Hono (e.g.honoin deps, Vite config)? Choose one variant. - •Next.js → Read nextjs.md and apply its rules (grep
.env→ ARGs, standalone output, pnpm). - •Hono → Read hono.md and apply its rules (rolldown/vite build, pnpm).
- •Package manager: Use pnpm when possible; fall back to npm only if no pnpm lockfile.
- •Use multi-stage builds: build stage for deps + build, final stage minimal (Node.js + app only).
- •Do not bake secrets into the image; document passing them at runtime.