liveBook · Manning

Multistage build

A multistage build is a container-image construction technique that uses multiple build stages and transfers selected artifacts into a final stage, often separating build dependencies from runtime contents.

How 3 Manning books explain it

Fast by Default

A multi-stage build uses separate image-building and runtime stages so that only runtime artifacts are copied into the final image.

How it is used
Reduces production container size by excluding build tools and development files from the runtime image.
How deep it goes
Explains Dockerfile stages, artifact copying, and language-specific applications without detailing image-layer internals.
Examples
Uses a checkout API, Python native extensions, Go binaries, Node.js output, Java JARs, and .NET published output.
What you can do after
Builds smaller runtime images by transferring only required artifacts from a full build environment.

Read how Fast by Default explains multistage build →

.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 →

Also covered in

What to know first

Related concepts

Questions about multistage build

What is multistage build?

A multistage build is a container-image construction technique that uses multiple build stages and transfers selected artifacts into a final stage, often separating build dependencies from runtime contents.

Which Manning books explain multistage build?

Fast by Default, .NET in Action, Second Edition and Rust Servers, Services, and Apps.

What should I know before learning multistage build?

Manning books that teach multistage build usually introduce contract first.

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.