मल्टि-स्टेज बिल्ड्स एक 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.
