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.

62 lines
2.3KB

  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 wget curl tar\
  9. && apt-get clean \
  10. && rm -rf /var/lib/apt/lists/*
  11. # 安装 TDengine 客户端
  12. RUN curl -o /tmp/TDengine-client-3.0.4.2-Linux-x64.tar.gz https://www.taosdata.com/assets-download/3.0/TDengine-client-3.0.4.2-Linux-x64.tar.gz
  13. WORKDIR /tmp
  14. # 解压
  15. RUN tar xvf TDengine-client-3.0.4.2-Linux-x64.tar.gz
  16. RUN ls
  17. # 切换文件夹
  18. WORKDIR /tmp/TDengine-client-3.0.4.2
  19. RUN ls
  20. # 执行安装脚本
  21. RUN bash install_client.sh
  22. # 设置 TDengine 服务器的 End Point
  23. RUN echo "firstEp 47.116.142.20:6030" >> /etc/taos/taos.cfg
  24. FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
  25. WORKDIR /src
  26. COPY ["nuget.config","."]
  27. COPY ["HealthMonitor.Common/HealthMonitor.Common.csproj", "HealthMonitor.Common/"]
  28. COPY ["HealthMonitor.Core/HealthMonitor.Core.csproj", "HealthMonitor.Core/"]
  29. COPY ["HealthMonitor.Model/HealthMonitor.Model.csproj", "HealthMonitor.Model/"]
  30. COPY ["HealthMonitor.Service/HealthMonitor.Service.csproj", "HealthMonitor.Service/"]
  31. COPY ["HealthMonitor.Util/HealthMonitor.Util.csproj", "HealthMonitor.Util/"]
  32. COPY ["HealthMonitor.WebApi/HealthMonitor.WebApi.csproj", "HealthMonitor.WebApi/"]
  33. RUN dotnet nuget remove source nuget.org
  34. #RUN dotnet nuget add source https://mirrors.cloud.tencent.com/nuget/ -n tencent_nuget
  35. RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n huaweicloud_nuget
  36. RUN dotnet restore "HealthMonitor.WebApi/HealthMonitor.WebApi.csproj"
  37. COPY . .
  38. WORKDIR "/src/HealthMonitor.WebApi"
  39. RUN dotnet build "HealthMonitor.WebApi.csproj" -c Release -o /app/build
  40. FROM build AS publish
  41. RUN dotnet publish "HealthMonitor.WebApi.csproj" -c Release -o /app/publish
  42. FROM base AS final
  43. WORKDIR /app
  44. COPY --from=publish /app/publish .
  45. #ENV environment=Development
  46. ENV urls=http://*:6899
  47. ENV TimeZone=Asia/Shanghai
  48. ENV LANG C.UTF-8
  49. RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
  50. #ENTRYPOINT dotnet HealthMonitor.WebApi.dll --environment=$environment
  51. ENTRYPOINT ["dotnet", "HealthMonitor.WebApi.dll"]
  52. CMD ["--environment=Development"]