My Docker examples are now part of the official Next.js Documentation

Published: (March 4, 2026 at 02:14 AM EST)
2 min read
Source: Dev.to

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.

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
  • Option B – Node.js serve with serve npm 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.

0 views
Back to Blog

Related posts

Read more »