मल्टी-स्टेज बिल्ड्स एका Dockerfile मध्ये अनेक FROM स्टेज वापरतात — एका स्टेज मध्ये अॅप्लिकेशन तयार करतात (सर्व बिल्ड टूल्सह) आणि केवळ अंतिम artifacts एका स्वच्छ, किमान अंतिम स्टेज मध्ये कॉपी करतात. हे खूप लहान, अधिक सुरक्षित production images तयार करते.
समस्या: बिल्ड टूल्स image ला फुगवतात
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.
