Русский flag Русский

Zero-Downtime

2026-03-02

If you still run next build directly on the production server — your server is really suffering. CPU pegged, OOM-kill, 502 errors and long downtimes — this is a classic that needs to end.

In 2026 the industry standard is separate builds:

  1. Build a minimal standalone image in the cloud (GitHub Actions).
  2. Push it to GHCR (GitHub Container Registry).
  3. On the server do only pull + atomic restart.

Chapter 1. The ideal Dockerfile (Multi-stage + Standalone)

The whole secret to a small and fast image is the standalone mode. Next.js itself figures out which files and parts of node_modules are actually needed to run the server, and copies only them.

Read more