24 lines
773 B
Text
24 lines
773 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 true --no-restore /p:PublishTrimmed=true /p:PublishReadyToRun=true
|
|
|
|
# final stage/image
|
|
# Uses the 2009 release; 2004, 1909, 1903, and 1809 are other choices
|
|
FROM mcr.microsoft.com/windows/nanoserver:2009 AS runtime
|
|
WORKDIR /app
|
|
COPY --from=build /app ./
|
|
|
|
# Configure web servers to bind to port 80 when present
|
|
ENV ASPNETCORE_URLS=http://+:80
|
|
|
|
ENTRYPOINT ["aspnetapp"]
|