|
- # final stage/image
-
- FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
- WORKDIR /app
- EXPOSE 6899
-
- RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
- RUN sed -i s@/security.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
-
- RUN apt-get update --fix-missing\
- && DEBIAN_FRONTEND=noninteractive apt-get install -y net-tools vim wget curl tar\
- && apt-get clean \
- && rm -rf /var/lib/apt/lists/*
-
- # 安装 TDengine 客户端
- 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
-
- WORKDIR /tmp
-
- # 解压
- RUN tar xvf TDengine-client-3.0.4.2-Linux-x64.tar.gz
- RUN ls
- # 切换文件夹
- WORKDIR /tmp/TDengine-client-3.0.4.2
- RUN ls
- # 执行安装脚本
- RUN bash install_client.sh
- # 设置 TDengine 服务器的 End Point
- RUN echo "firstEp 47.116.142.20:6030" >> /etc/taos/taos.cfg
-
- FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
- WORKDIR /src
- COPY ["nuget.config","."]
- COPY ["HealthMonitor.Common/HealthMonitor.Common.csproj", "HealthMonitor.Common/"]
- COPY ["HealthMonitor.Core/HealthMonitor.Core.csproj", "HealthMonitor.Core/"]
- COPY ["HealthMonitor.Model/HealthMonitor.Model.csproj", "HealthMonitor.Model/"]
- COPY ["HealthMonitor.Service/HealthMonitor.Service.csproj", "HealthMonitor.Service/"]
- COPY ["HealthMonitor.Util/HealthMonitor.Util.csproj", "HealthMonitor.Util/"]
- COPY ["HealthMonitor.WebApi/HealthMonitor.WebApi.csproj", "HealthMonitor.WebApi/"]
- RUN dotnet nuget remove source nuget.org
- #RUN dotnet nuget add source https://mirrors.cloud.tencent.com/nuget/ -n tencent_nuget
- RUN dotnet nuget add source https://repo.huaweicloud.com/repository/nuget/v3/index.json -n huaweicloud_nuget
- RUN dotnet restore "HealthMonitor.WebApi/HealthMonitor.WebApi.csproj"
- COPY . .
- WORKDIR "/src/HealthMonitor.WebApi"
- RUN dotnet build "HealthMonitor.WebApi.csproj" -c Release -o /app/build
-
- FROM build AS publish
- RUN dotnet publish "HealthMonitor.WebApi.csproj" -c Release -o /app/publish
-
- FROM base AS final
- WORKDIR /app
- COPY --from=publish /app/publish .
- #ENV environment=Development
- ENV urls=http://*:6899
- ENV TimeZone=Asia/Shanghai
- ENV LANG C.UTF-8
- RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone
- #ENTRYPOINT dotnet HealthMonitor.WebApi.dll --environment=$environment
-
- ENTRYPOINT ["dotnet", "HealthMonitor.WebApi.dll"]
- CMD ["--environment=Development"]
|