Docker has been gaining significant traction lately, most of it can be credited to it's ability to create portable lightweight containers very quickly for continuous deployments and sprawling testing and staging environments. These environments would require a Dockerfile to carry a set of steps and instructions that would be needed to successfully restore, build and publish a .net or .netcore application.
# Build SDK image
FROM microsoft/dotnet-framework:4.7.1-sdk AS build-env # .net
FROM microsoft/dotnet:2.1-sdk AS build-env # .netcore
Let's begin right away with the 1st step; selecting a build SDK image. For .net applications it would be microsoft/dotnet-framework:4.7.1-sdk and for .netcore applications we'll use microsoft/dotnet:2.1-sdk. Both of these are Windows images. The following would be the first step of our Dockerfile:
FROM microsoft/dotnet-framework:4.7.1-sdk AS build-env # .net
FROM microsoft/dotnet:2.1-sdk AS build-env # .netcore