Multistage build
A multistage build is a container-image construction technique that uses separate build stages and includes only selected artifacts in the final runtime image.
.NET in Action, Second Edition
A multistage build constructs an image through multiple Dockerfile build stages so that artifacts from an earlier stage can be copied into a later runtime stage.
- How it is used
- Separates application publishing from runtime execution to produce a container that starts without NuGet restore or compilation.
- How deep it goes
- Explains stages, base images, artifact copying, ports, entry points, and named-stage syntax through complete Dockerfiles.
- Examples
- Uses the AsciiArtSvc service with SDK and aspnet images, numbered and named stages, published output, port 80, and a DLL entry point.
- What you can do after
- Builds a smaller runtime-focused Docker image from a publish stage and configures it to launch the published ASP.NET Core application.
Read how .NET in Action, Second Edition explains multistage build →
Rust Servers, Services, and Apps
A multistage Docker build uses multiple Dockerfile stages so that only selected artifacts from earlier stages are included in the final image.
- How it is used
- Packages a Rust web service for deployment while reducing the final Docker image.
- How deep it goes
- Explains multiple FROM stages, named stages, artifact copying, image-size verification, runtime testing, and security and caching benefits.
- Examples
- Uses a Rust builder, Google Distroless runtime, Dockerfile-lite, a 31.8 MB image, and localhost greeting endpoints.
- What you can do after
- Build and run a smaller Rust Docker image using named stages and a runtime-only artifact.
Read how Rust Servers, Services, and Apps explains multistage build →
Related concepts
- Dockerfileuses · A Dockerfile is a text file containing declarative instructions for building a container image and specifying its contents and runtime metadata.
- container imageproduces · A container image is a packaged filesystem and configuration artifact from which a container can be created and run.
- from instructionuses · The FROM instruction is a Dockerfile directive that selects the base image or empty filesystem for a container image build stage.
- Dockerimplemented by · Docker is a platform and ecosystem for building, distributing, and running applications in containers.
- code compilationuses · Code compilation is the translation of source code or another formal representation into an executable, intermediate, or lower-level representation.
- software artifactproduces · A software artifact is a persistent work product or object produced or maintained during software development or a related workflow.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

