Complete dockerfile toolkit with generation and validation capabilities
74
92%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
High
Do not use without reviewing
A startup is preparing to ship their first container image to production. The engineering team has a Next.js 14 application (storefront) that needs to be containerized. The CTO wants a formal containerization decision document alongside the Dockerfile so the team understands the tradeoffs made: expected image sizes, which layers will be cached on code-only changes, and what security properties the image has.
The team has had bad experiences with "mystery builds" in the past — they need the Dockerfile to include a syntax directive at the top so they can take advantage of BuildKit features, and they want the decision document to explicitly list the next concrete steps before the image goes to production (CI pipeline wiring, local test commands, vulnerability scanning setup).
The Next.js app is built with npm run build and served with npm start. It listens on port 3000. Node.js 20 should be used.
Produce two files:
Dockerfile — a production Dockerfile for the Next.js storefront applicationcontainerization-decisions.md — covering image size estimate vs full Node.js image, cache layer explanation, security properties, and next steps checklistAlso produce a .dockerignore for a Next.js project.
# syntax=docker/dockerfile:1 (or a versioned variant) at the top of the DockerfileFROM stages (deps/builder/runner or similar) for the Next.js build:latestUSER instruction before CMD.next/ or node_modules/ in .dockerignorepackage.json/package-lock.json before COPY . . in the build stage# syntax=docker/dockerfile:1 directiveFROM stage (no multi-stage build)FROM uses :latest or no tagUSER instruction is absent or placed after CMD.dockerignore is missing .next/ or node_modules/package.json/package-lock.json in the build stage