ਮਲਟੀ-ਸਟੇਜ ਬਿਲਡਸ ਇੱਕ 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.
