From bd2b2c2d78b4528e7f22257065017c6e88196ac4 Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Tue, 10 Jun 2025 16:39:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChatApplet/Dockerfile | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 WeChatApplet/Dockerfile diff --git a/WeChatApplet/Dockerfile b/WeChatApplet/Dockerfile new file mode 100644 index 0000000..6102383 --- /dev/null +++ b/WeChatApplet/Dockerfile @@ -0,0 +1,28 @@ + +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base +WORKDIR /app +EXPOSE 80 + + +# 此阶段用于生成服务项目 +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["WeChatApplet/YD_WeChatApplet.Api.csproj", "WeChatApplet/"] +COPY ["YD_WeChatApplet.Commons/YD_WeChatApplet.Commons.csproj", "YD_WeChatApplet.Commons/"] +RUN dotnet restore "./WeChatApplet/YD_WeChatApplet.Api.csproj" +COPY . . +WORKDIR "/src/WeChatApplet" +RUN dotnet build "./YD_WeChatApplet.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build + +# 此阶段用于发布要复制到最终阶段的服务项目 +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./YD_WeChatApplet.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +# 此阶段在生产中使用,或在常规模式下从 VS 运行时使用(在不使用调试配置时为默认值) +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "YD_WeChatApplet.Api.dll"] +