docker-based-development-guide/c#/Dockerfile

21 lines
468 B
Docker

FROM mcr.microsoft.com/dotnet/sdk:2.1-focal as dev
RUN mkdir /app/
WORKDIR /app/
COPY ./src/work.csproj /app/work.csproj
RUN dotnet restore
COPY ./src/ /app/
RUN mkdir /out/
RUN dotnet publish --no-restore --output /out/ --configuration Release
################# PRODUCTION IMAGE #################
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1-stretch-slim as prod
RUN mkdir /app/
WORKDIR /app/
COPY --from=dev /out/ /app/
RUN chmod +x /app/
CMD dotnet work.dll