nextjs-docker
Installation
SKILL.md
Base Images
Use official Node.js images from Docker Hub. Pin to a specific version tag with an OS variant.
| Stage | Image | Purpose |
|---|---|---|
| Install + Build | node:<version>-alpine |
Full Node.js for npm ci and next build |
| Runtime (final) | node:<version>-alpine |
Minimal runtime for node server.js |
Rules:
- Pin to a specific Node.js LTS version:
node:22-alpine, notnode:latest. - Match the Node.js version across all stages.
- Alpine is the default. Use
-slim(Debian) only if native dependencies require glibc.
Standalone Output Mode
Configure Next.js to produce a standalone output bundle that includes only the dependencies needed at runtime — no node_modules copying required.