You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 satır
1.9KB

  1. # final stage/image
  2. FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
  3. WORKDIR /app
  4. EXPOSE 6899
  5. RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
  6. RUN sed -i s@/security.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
  7. RUN apt-get update --fix-missing\
  8. && DEBIAN_FRONTEND=noninteractive apt-get install -y net-tools vim \
  9. && apt-get clean \
  10. && rm -rf /var/lib/apt/lists/*
  11. FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
  12. WORKDIR /src
  13. COPY ["nuget.config","."]
  14. COPY ["HealthMonitor.Common/HealthMonitor.Common.csproj", "HealthMonitor.Common/"]
  15. COPY ["HealthMonitor.Core/HealthMonitor.Core.csproj", "HealthMonitor.Core/"]
  16. COPY ["HealthMonitor.Model/HealthMonitor.Model.csproj", "HealthMonitor.Model/"]
  17. COPY ["HealthMonitor.Service/HealthMonitor.Service.csproj", "HealthMonitor.Service/"]
  18. COPY ["HealthMonitor.Util/HealthMonitor.Util.csproj", "HealthMonitor.Util/"]
  19. COPY ["HealthMonitor.WebApi/HealthMonitor.WebApi.csproj", "HealthMonitor.WebApi/"]
  20. RUN dotnet nuget remove source nuget.org
  21. #RUN dotnet nuget add source https://mirrors.cloud.tencent.com/nuget/ -n tencent_nuget
  22. RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n huaweicloud_nuget
  23. RUN dotnet restore "HealthMonitor.WebApi/HealthMonitor.WebApi.csproj"
  24. COPY . .
  25. WORKDIR "/src/HealthMonitor.WebApi"
  26. RUN dotnet build "HealthMonitor.WebApi.csproj" -c Release -o /app/build
  27. FROM build AS publish
  28. RUN dotnet publish "HealthMonitor.WebApi.csproj" -c Release -o /app/publish
  29. FROM base AS final
  30. WORKDIR /app
  31. COPY --from=publish /app/publish .
  32. #ENV environment=Development
  33. ENV urls=http://*:6899
  34. ENV TimeZone=Asia/Shanghai
  35. ENV LANG C.UTF-8
  36. RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
  37. #ENTRYPOINT dotnet HealthMonitor.WebApi.dll --environment=$environment
  38. ENTRYPOINT ["dotnet", "HealthMonitor.WebAapi.dll"]
  39. CMD ["--environment=Development"]