github.com/rohankumardubey/draft-classic@v0.16.0/packs/csharp/Dockerfile (about)

     1  FROM microsoft/dotnet:2.1-sdk AS builder
     2  WORKDIR /app
     3  
     4  # caches restore result by copying csproj file separately
     5  COPY *.csproj .
     6  RUN dotnet restore
     7  
     8  COPY . .
     9  RUN dotnet publish --output /app/ --configuration Release
    10  RUN sed -n 's:.*<AssemblyName>\(.*\)</AssemblyName>.*:\1:p' *.csproj > __assemblyname
    11  RUN if [ ! -s __assemblyname ]; then filename=$(ls *.csproj); echo ${filename%.*} > __assemblyname; fi
    12  
    13  # Stage 2
    14  FROM microsoft/dotnet:2.1-aspnetcore-runtime
    15  WORKDIR /app
    16  COPY --from=builder /app .
    17  
    18  ENV PORT 80
    19  EXPOSE 80
    20  
    21  ENTRYPOINT dotnet $(cat /app/__assemblyname).dll