FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["Znyc.Admin.WebApi/Znyc.Admin.WebApi.csproj", "Znyc.Admin.WebApi/"] COPY ["Znyc.Admin.MongoDb/Znyc.Admin.MongoDb.Core.csproj", "Znyc.Admin.MongoDb/"] COPY ["Znyc.Admin.NetCore/Znyc.Admin.AspNetCore/Znyc.Admin.AspNetCore.csproj", "Znyc.Admin.NetCore/Znyc.Admin.AspNetCore/"] COPY ["Znyc.Admin.NetCore/Znyc.Admin.Security.Core/Znyc.Admin.Security.Core.csproj", "Znyc.Admin.NetCore/Znyc.Admin.Security.Core/"] COPY ["Znyc.Admin.WeChat.Core/Znyc.Admin.WeChat.Core.csproj", "Znyc.Admin.WeChat.Core/"] COPY ["Znyc.Admin.NetCore/Znyc.Admin.Commons/Znyc.Admin.Commons.csproj", "Znyc.Admin.NetCore/Znyc.Admin.Commons/"] RUN dotnet restore "Znyc.Admin.WebApi/Znyc.Admin.WebApi.csproj" COPY . . WORKDIR "/src/Znyc.Admin.WebApi" RUN dotnet build "Znyc.Admin.WebApi.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "Znyc.Admin.WebApi.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "Znyc.Admin.WebApi.dll"]