This commit is contained in:
tanglong 2025-06-10 16:39:13 +08:00
parent 0acddbd025
commit bd2b2c2d78

28
WeChatApplet/Dockerfile Normal file
View File

@ -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"]