মাল্টি-স্টেজ বিল্ডস একটি 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.
