Dockerfile 1.1 KB

1234567891011121314151617181920212223242526272829
  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. FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
  3. USER app
  4. WORKDIR /app
  5. EXPOSE 8080
  6. EXPOSE 8081
  7. FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
  8. ARG BUILD_CONFIGURATION=Release
  9. WORKDIR /src
  10. COPY ["MTWorkHR.API/MTWorkHR.API.csproj", "MTWorkHR.API/"]
  11. COPY ["MTWorkHR.Application/MTWorkHR.Application.csproj", "MTWorkHR.Application/"]
  12. COPY ["MTWorkHR.Core/MTWorkHR.Core.csproj", "MTWorkHR.Core/"]
  13. COPY ["MTWorkHR.Identity/MTWorkHR.Identity.csproj", "MTWorkHR.Identity/"]
  14. COPY ["MTWorkHR.Infrastructure/MTWorkHR.Infrastructure.csproj", "MTWorkHR.Infrastructure/"]
  15. RUN dotnet restore "./MTWorkHR.API/./MTWorkHR.API.csproj"
  16. COPY . .
  17. WORKDIR "/src/MTWorkHR.API"
  18. RUN dotnet build "./MTWorkHR.API.csproj" -c $BUILD_CONFIGURATION -o /app/build
  19. FROM build AS publish
  20. ARG BUILD_CONFIGURATION=Release
  21. RUN dotnet publish "./MTWorkHR.API.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
  22. FROM base AS final
  23. WORKDIR /app
  24. COPY --from=publish /app/publish .
  25. ENTRYPOINT ["dotnet", "MTWorkHR.API.dll"]