I build multi-stage utilizzano più stage FROM in un unico Dockerfile — costruendo l'applicazione in uno stage (con tutti i tool di build) e copiando solo gli artefatti finali in uno stage finale pulito e minimalista. Questo produce immagini di produzione molto più piccole e sicure.
Il problema: i tool di build gonfiano l'immagine
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.
