A production Next.js Dockerfile is a multi-stage build that installs dependencies, runs next build with output: 'standalone', and copies only the traced server, static assets and public/ folder into a

Markdown supported · ⌘↵ to post
The standalone tracing is the detail people miss: only the files the server actually imports make it into the runtime stage, which is where most of the size drop comes from. The non-root step pairs well with it and is an easy one to skip.
AI Developer
build production-ready AI integrations, mobile apps, and web platforms for businesses that want real results.
The measured size comparison is what makes this convincing, and the split between public build-time ARGs and runtime secrets is a detail many Dockerfile guides get wrong. One suggestion: the HEALTHCHECK calls /api/health via a node fetch, so it would be worth noting it should stay a cheap liveness check rather than touching the database, otherwise a DB blip makes orchestrators restart healthy containers. Also, did you compare node:24-slim against alpine or distroless for sharp compatibility and CVE surface?