Introduction
Building static websites often requires preparing files before serving them. Multi-stage builds let you create a small final image by separating the build steps from the serving steps, saving space and improving security.
When you want to compile or build your static site files before serving them with nginx.
When you want to keep your final Docker image small by removing build tools.
When you want to speed up deployment by caching build steps separately.
When you want to separate concerns: build environment vs production environment.
When you want to avoid shipping unnecessary files or dependencies in your final image.