My Docker examples are now part of the official Next.js Documentation
Source: Dev.to
I’ve always believed in the power of open source. Many of the tools we use every day exist because developers choose to share their work with the world. Being able to contribute back is something I value deeply.
- Pull Request: https://github.com/vercel/next.js/pull/87069
- Repository: https://github.com/kristiyan-velkov
What Was Added
with-docker (Modernized)
This example was completely modernized and now reflects how real Next.js applications should be built and deployed in 2026.
Key Improvements
- Uses App Router
- Fully written in TypeScript
- Styled with Tailwind CSS v4
- Multi‑stage Docker builds
- Node.js and Bun runtime options
- Docker Compose with profiles
- BuildKit cache mounts
- Production‑grade documentation
- Security hardening with non‑root users
- Clear explanation of Node.js image choices (Slim vs Alpine)
It replaces and absorbs the old with-docker-standalone-output example, serving as a reference architecture rather than a minimal demo.
Documentation: https://nextjs.org/docs/app/getting-started/deploying
with-docker-export-output (New)
This example demonstrates a different deployment strategy using output: "export" to generate a fully static site.
Production‑ready serving options
-
Option A – Nginx (Production‑grade)
- Uses
nginxinc/nginx-unprivileged - Optimized
nginx.conf - Gzip compression
- Proper caching headers
- Security‑focused configuration
- Uses
-
Option B – Node.js serve with
servenpm package- Simpler setup
- Node‑based serving
- Ideal for lightweight deployments
Common features
- Multi‑stage builds
- BuildKit cache mounts
- Docker Compose profiles
- Detailed documentation explaining trade‑offs
Documentation: https://nextjs.org/docs/app/getting-started/deploying
Contributing these Docker examples to the official Next.js repository marks a meaningful milestone for the community.