20 lines
650 B
Text
20 lines
650 B
Text
# https://hub.docker.com/_/microsoft-dotnet-core
|
|
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
|
|
WORKDIR /source
|
|
|
|
# copy csproj and restore as distinct layers
|
|
COPY *.sln .
|
|
COPY aspnetapp/*.csproj ./aspnetapp/
|
|
RUN dotnet restore -r win-x64
|
|
|
|
# copy everything else and build app
|
|
COPY aspnetapp/. ./aspnetapp/
|
|
WORKDIR /source/aspnetapp
|
|
RUN dotnet publish -c release -o /app -r win-x64 --self-contained false --no-restore
|
|
|
|
# final stage/image
|
|
# Uses the 2009 release; 2004, 1909, 1903, and 1809 are other choices
|
|
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-2009 AS runtime
|
|
WORKDIR /app
|
|
COPY --from=build /app ./
|
|
ENTRYPOINT ["aspnetapp"]
|