Builds multi-estágio usam múltiplos estágios FROM em um único Dockerfile — construindo a aplicação em um estágio (com todas as ferramentas de build) e copiando apenas os artefatos finais para um estágio final limpo e minimalista. Isso produz imagens de produção muito menores e mais seguras.
O problema: ferramentas de build incham a imagem
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.
