Dockerfile 1.1 KB

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