Kelių etapų konstruktai naudoja kelis FROM etapus viename Dockerfile — sukurdami programą viename etape (su visomis kompiliacijos priemonėmis) ir kopijuodami tik galutinį artefaktą į švarų, minimalų galutinį etapą. Tai sukuria daug mažesnius, saugesnius gamybos vaizdus.
Problema: kompiliacijos priemonės padidina vaizdo dydį
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.
