Created
March 29, 2021 10:31
-
-
Save sjwaight/f95dcb48b3fb106a41169f5c3832c643 to your computer and use it in GitHub Desktop.
Full dockerfile that shows how to build and package an .NET Framework application for use with Windows Containers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 AS build | |
| WORKDIR /app | |
| # copy csproj and restore as distinct layers | |
| COPY MvcMusicStore-Completed/*.sln . | |
| COPY MvcMusicStore-Completed/MvcMusicStore/*.csproj ./MvcMusicStore/ | |
| COPY MvcMusicStore-Completed/MvcMusicStore/*.config ./MvcMusicStore/ | |
| RUN nuget restore | |
| # copy everything else and build app | |
| COPY MvcMusicStore-Completed/MvcMusicStore/. ./MvcMusicStore/ | |
| WORKDIR /app/MvcMusicStore | |
| RUN msbuild /p:Configuration=Release -r:False | |
| FROM mcr.microsoft.com/dotnet/framework/aspnet:4.8 AS runtime | |
| WORKDIR /inetpub/wwwroot | |
| COPY --from=build /app/MvcMusicStore/. ./ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment