Multi-Stage-Builds verwenden mehrere FROM-Stages in einer einzigen Dockerfile — die Anwendung wird in einer Stage gebaut (mit allen Build-Tools) und nur die finalen Artefakte werden in eine saubere, minimale finale Stage kopiert. Dies erzeugt deutlich kleinere, sicherere Production-Images.
Das Problem: Build-Tools blähen das Image auf
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.
