Večstopenjski gradovi uporabljajo več FROM stopenj v eni Dockerfile datoteki — aplikacija se gradi v eni stopnji (z vsemi gradilnimi orodji) in samo končni artefakti se kopirajo v čisto, minimalno končno stopnjo. To proizvede veliko manjše, bolj varne produkcijske slike.
Problem: gradilna orodja napolnijo sliko
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.
