# 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 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* 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"]