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

29 lines
697 B
Docker

############# DEV IMAGE #################
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch 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 --output /out/ --configuration Release
############# DEBUG IMAGE ################
FROM dev as debug
RUN apt-get update
RUN apt-get install -y unzip
RUN curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l ~/vsdbg
RUN dotnet run
############## PRODUCT IMAGE #############
FROM mcr.microsoft.com/dotnet/core/sdk:2.2-stretch-slim as prod
RUN mkdir /app/
WORKDIR /app/
COPY --from=dev /out/ /app/
RUN chmod +x /app/
CMD dotnet work.dll