live-forum/server/webapi/LiveForum/LiveForum.WebApi/Dockerfile
zpc 442f32a043
All checks were successful
continuous-integration/drone/push Build is passing
feat(deployment): add v1.2.0 database scripts and improve Docker/auth configuration
- Add v1.2.0 complete database upgrade scripts for business and admin databases
- Enhance WeChat login logic to handle OpenId reassociation when user logs in via phone number
- Add UpdatedAt timestamp update in WeChat login record updates
- Configure Docker container permissions for AgileConfig cache file writes
- Add Caddy image tagging to CI-CD deployment documentation
- Update frontend Config.js for deployment configuration management
2026-03-26 22:10:57 +08:00

40 lines
1.7 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 请参阅 https://aka.ms/customizecontainer 以了解如何自定义调试容器,以及 Visual Studio 如何使用此 Dockerfile 生成映像以更快地进行调试。
# 此阶段用于在快速模式(默认为调试配置)下从 VS 运行时
FROM 192.168.195.25:19900/library/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
# 此阶段用于生成服务项目
FROM 192.168.195.25:19900/library/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["LiveForum.WebApi/LiveForum.WebApi.csproj", "LiveForum.WebApi/"]
COPY ["LiveForum.IService/LiveForum.IService.csproj", "LiveForum.IService/"]
COPY ["LiveForum.Code/LiveForum.Code.csproj", "LiveForum.Code/"]
COPY ["LiveForum.Model/LiveForum.Model.csproj", "LiveForum.Model/"]
COPY ["LiveForum.Repository/LiveForum.Repository.csproj", "LiveForum.Repository/"]
COPY ["LiveForum.Service/LiveForum.Service.csproj", "LiveForum.Service/"]
RUN dotnet restore "./LiveForum.WebApi/LiveForum.WebApi.csproj"
COPY . .
WORKDIR "/src/LiveForum.WebApi"
RUN dotnet build "./LiveForum.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build
# 此阶段用于发布要复制到最终阶段的服务项目
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./LiveForum.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# 此阶段在生产中使用,或在常规模式下从 VS 运行时使用(在不使用调试配置时为默认值)
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
# 给 AgileConfig 缓存文件写权限app 用户需要写入配置缓存)
USER root
RUN mkdir -p /app && chown -R $APP_UID:$APP_UID /app
USER $APP_UID
ENTRYPOINT ["dotnet", "LiveForum.WebApi.dll"]