dotnet / dotnet/announcements

.NET Core Docker Samples now use Multi-Stage Build

Open
#18 1 comment 0 reactions 0 assignees View on GitHub
Docker Enhancement
Dominant language
No language data
Stars
1.4k
Forks
53
PR merge metrics
No merged PRs in 30d

Description

# .NET Core Docker Samples now use Multi-Stage Build

## Summary
.NET Core Docker images can now use multi-stage build using a new feature from Docker that allows multiple `FROM` lines to be used in one Dockerfile. The multi-stage build feature was recently introduced into the Docker client Stable channel. Using this feature, you can build a .NET Core app in an SDK image (AKA 'build image') and then copy the published app into a runtime image all in the same Dockerfile. To see an example of this in practice, check out the [.NET Docker Samples Repo](https://github.com/dotnet/dotnet-docker-samples).

## Details
- [Update samples to utilize multi-step build feature - dotnet/dotnet-docker-samples #44](https://github.com/dotnet/dotnet-docker-samples/pull/44)
- [Dockerfile of .NET app production sample](https://github.com/dotnet/dotnet-docker-samples/blob/master/dotnetapp-prod/Dockerfile)
- [Docker Documentation on Multi-Stage Build](https://docs.docker.com/engine/userguide/eng-image/multistage-build/#use-multi-stage-builds)

## Impact
Before the multi-stage build feature was added, a script was required to copy the published output of your build container onto your disk and then the runtime container would read in that output. This was tedious to implement and not super efficient. Now, containers can share build artifacts from different stages within a single Dockerfile.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.