మల్టీ-స్టేజ్ బిల్డ్లు ఒకే Dockerfile లో బహుళ FROM స్టేజ్లను ఉపయోగిస్తాయి — అప్లికేషన్ను ఒక స్టేజ్లో (అన్ని బిల్డ్ టూల్ల ఉపయోగంతో) నిర్మించి, చివరి ఆర్టిఫ్యాక్ట్లను మాత్రమే శుభ్ర, కనిష్ట చివరి స్టేజ్లోకి కాపీ చేస్తాయి. ఇది చాలా చిన్న, మరింత సురక్షితమైన ఉత్పత్తి చిత్రాలను సృష్టిస్తుంది.
సమస్య: బిల్డ్ టూల్లు చిత్రాన్ని ఫూర్తిచేస్తాయి
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.
