Vícestupňové buildy používají více FROM stupňů v jednom Dockerfile — aplikace se vytváří v jednom stupni (se všemi build nástroji) a do čistého, minimálního finálního stupně se kopírují pouze konečné artefakty. To vytváří mnohem menší, bezpečnější produkční image.
Problém: build nástroje přidělují velikost image
Building an app needs build tools (compilers, dev dependencies, SDKs), but the
FINAL image shouldn't include them:
→ they bloat the image (larger size, slower deploys)
→ they increase the attack surface (more software = more vulnerabilities)
→ You want only the built artifact + its runtime in the final image.
