MediumConceptContainers in depth
How do multi-stage builds help?
What a good answer covers
You build in a stage with compilers and tools and copy only the artifacts into a minimal final image, which makes images smaller and reduces the attack surface.