Skip to content

Instantly share code, notes, and snippets.

@richlander
Created June 14, 2018 00:57
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richlander/8f58e5abecafdb727cd438ab799ec7f6 to your computer and use it in GitHub Desktop.
Save richlander/8f58e5abecafdb727cd438ab799ec7f6 to your computer and use it in GitHub Desktop.
ASP.NET Web Forms Multi-stage build Dockerfile
FROM microsoft/dotnet-framework:4.7.2-sdk AS build
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
COPY aspnetapp/*.config ./aspnetapp/
RUN nuget restore
# copy everything else and build app
COPY aspnetapp/. ./aspnetapp/
WORKDIR /app/aspnetapp
RUN msbuild /p:Configuration=Release
# copy build artifacts into runtime image
FROM microsoft/aspnet:4.7.2 AS runtime
WORKDIR /inetpub/wwwroot
COPY --from=build /app/aspnetapp/. ./
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment