liveBook · Manning

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.

How 2 Manning books explain it

.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

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.