選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

70 行
2.7KB

  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 nuget add source https://nuget.cdn.azure.cn/v3/index.json -n azure_nuget
  37. RUN dotnet restore "HealthMonitor.WebApi/HealthMonitor.WebApi.csproj"
  38. COPY . .
  39. WORKDIR "/src/HealthMonitor.WebApi"
  40. RUN dotnet build "HealthMonitor.WebApi.csproj" -c Release -o /app/build
  41. FROM build AS publish
  42. RUN dotnet publish "HealthMonitor.WebApi.csproj" -c Release -o /app/publish
  43. FROM base AS final
  44. WORKDIR /app
  45. COPY --from=publish /app/publish .
  46. ENV environment=Development
  47. ENV urls=http://*:6899
  48. ENV TimeZone=Asia/Shanghai
  49. ENV LANG C.UTF-8
  50. RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
  51. #ENTRYPOINT dotnet HealthMonitor.WebApi.dll --environment=$environment
  52. ENV FirstEP=47.116.142.20:6030
  53. #ENV FirstEP=172.19.42.44:6030
  54. # 设置 TDengine 服务器的 End Point
  55. #RUN echo "firstEp "$FirstEP >> /etc/taos/taos.cfg
  56. #ENTRYPOINT ["dotnet", "HealthMonitor.WebApi.dll"]
  57. #CMD ["--environment=Development"]
  58. CMD sh -c "echo 'firstEp $FirstEP' >> /etc/taos/taos.cfg && dotnet HealthMonitor.WebApi.dll --environment=$environment"