Dockerfile 1.3 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. FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
  3. WORKDIR /app
  4. EXPOSE 80
  5. EXPOSE 8888
  6. FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
  7. ARG BUILD_CONFIGURATION=Release
  8. WORKDIR /src
  9. COPY ["ZR.Admin.WebApi/ZR.Admin.WebApi.csproj", "ZR.Admin.WebApi/"]
  10. COPY ["ZR.CodeGenerator/ZR.CodeGenerator.csproj", "ZR.CodeGenerator/"]
  11. COPY ["Infrastructure/ZR.Infrastructure.csproj", "Infrastructure/"]
  12. COPY ["ZR.Common/ZR.Common.csproj", "ZR.Common/"]
  13. COPY ["ZR.ServiceCore/ZR.ServiceCore.csproj", "ZR.ServiceCore/"]
  14. COPY ["ZR.Repository/ZR.Repository.csproj", "ZR.Repository/"]
  15. COPY ["ZR.Model/ZR.Model.csproj", "ZR.Model/"]
  16. COPY ["ZR.Service/ZR.Service.csproj", "ZR.Service/"]
  17. COPY ["ZR.Tasks/ZR.Tasks.csproj", "ZR.Tasks/"]
  18. RUN dotnet restore "./ZR.Admin.WebApi/ZR.Admin.WebApi.csproj"
  19. COPY . .
  20. WORKDIR "/src/ZR.Admin.WebApi"
  21. RUN dotnet build "./ZR.Admin.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build
  22. FROM build AS publish
  23. ARG BUILD_CONFIGURATION=Release
  24. RUN dotnet publish "./ZR.Admin.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
  25. FROM base AS final
  26. WORKDIR /app
  27. COPY --from=publish /app/publish .
  28. ENTRYPOINT ["dotnet", "ZR.Admin.WebApi.dll"]