You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
618 B

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