Dockerfile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  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:9.0-nanoserver-1809 AS base
  6. WORKDIR /app
  7. EXPOSE 8080
  8. EXPOSE 8081
  9. # This stage is used to build the service project
  10. FROM mcr.microsoft.com/dotnet/sdk:9.0-nanoserver-1809 AS build
  11. ARG BUILD_CONFIGURATION=Release
  12. WORKDIR /src
  13. COPY ["Deathwatch/Deathwatch.csproj", "Deathwatch/"]
  14. COPY ["DataLayer/DataLayer.csproj", "DataLayer/"]
  15. COPY ["Domain/Domain.csproj", "Domain/"]
  16. COPY ["Infrastructure/Infrastructure.csproj", "Infrastructure/"]
  17. COPY ["Services/Services.csproj", "Services/"]
  18. RUN dotnet restore "./Deathwatch/Deathwatch.csproj"
  19. COPY . .
  20. WORKDIR "/src/Deathwatch"
  21. RUN dotnet build "./Deathwatch.csproj" -c %BUILD_CONFIGURATION% -o /app/build
  22. # This stage is used to publish the service project to be copied to the final stage
  23. FROM build AS publish
  24. ARG BUILD_CONFIGURATION=Release
  25. RUN dotnet publish "./Deathwatch.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false
  26. # This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
  27. FROM base AS final
  28. WORKDIR /app
  29. COPY --from=publish /app/publish .
  30. ENTRYPOINT ["dotnet", "Deathwatch.dll"]