A county library app Dockerfile copies source, runs npm install, then leaves compilers and caches in the final image. How should the team shrink the runtime image?
Select an answer to reveal the explanation.
Short Explanation
Build tools are like scaffolding around a building—great while you construct, ugly if you leave them forever. Multi-stage Dockerfiles let you compile in one stage, then copy just the finished app into a clean runtime image without the hammers and sawdust.
Full Explanation
Multi-stage builds separate compile/install work from the runtime image. The build stage may include npm, compilers, and caches; the final stage starts from a minimal base and COPY --from=build only the artifacts needed to run. That shrinks image size and reduces tools available to an attacker. Node-local cleanup or DaemonSets do not fix what is baked into the image layers.