Dockerfile 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. # See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
  2. # Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed.
  3. # For more information, please see https://aka.ms/containercompat
  4. # This stage is used when running from VS in fast mode (Default for Debug configuration)
  5. FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
  6. WORKDIR /app
  7. EXPOSE 80
  8. EXPOSE 443
  9. # This stage is used to build the service project
  10. FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
  11. ARG BUILD_CONFIGURATION=Release
  12. WORKDIR /src
  13. COPY ["Deathwatch/Deathwatch.csproj", "Deathwatch/"]
  14. RUN dotnet restore "./Deathwatch/Deathwatch.csproj"
  15. COPY . .
  16. WORKDIR "/src/Deathwatch"
  17. RUN dotnet build "./Deathwatch.csproj" -c %BUILD_CONFIGURATION% -o /app/build
  18. # This stage is used to publish the service project to be copied to the final stage
  19. FROM build AS publish
  20. ARG BUILD_CONFIGURATION=Release
  21. RUN dotnet publish "./Deathwatch.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false
  22. # This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
  23. FROM base AS final
  24. WORKDIR /app
  25. COPY --from=publish /app/publish .
  26. ENTRYPOINT ["dotnet", "Deathwatch.dll"]