记录保存
FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base
WORKDIR /src
# 更换源,并安装必要调试工具
RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
apt-get -y -q update && apt-get install -y -q apt-utils libgdiplus libc6-dev lsof net-tools wget curl iputils-ping inetutils-tools && \
apt-get autoremove -y && apt-get clean && apt-get autoclean && rm /var/cache/apt/* -rf
#下载解压,并安装
RUN curl -o TDengine-client.tar.gz "https://www.taosdata.com/assets-download/TDengine-client-2.2.0.1-Linux-x64.tar.gz" && \
tar -xvf TDengine-client.tar.gz && rm TDengine-client.tar.gz -f && cd $(ls TDengine-client* -d) && \
./install_client.sh && \
rm $(pwd) -rf
#更改时区
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' >/etc/timezone
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["TaosDemo/TaosDemo.csproj", "TaosDemo/"]
RUN dotnet restore "TaosDemo/TaosDemo.csproj"
COPY . .
WORKDIR "/src/TaosDemo"
RUN dotnet build "TaosDemo.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "TaosDemo.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TaosDemo.dll"]