Skip to content

Commit 4e816f7

Browse files
committed
build(docker): 升级 .NET 10.0 镜像并添加 hotfix 热更新支持
- 基础镜像从 8.0 升级到 10.0 - 新增 Hotfix 和 CodeGenerator 项目的构建步骤 - 添加 entrypoint 脚本自动初始化 hotfix 目录
1 parent bf48b36 commit 4e816f7

1 file changed

Lines changed: 42 additions & 26 deletions

File tree

Dockerfile

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,42 @@
1-
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
2-
USER $APP_UID
3-
WORKDIR /app
4-
5-
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
6-
ARG BUILD_CONFIGURATION=Release
7-
WORKDIR /src
8-
9-
COPY ["GameFrameX.Launcher/GameFrameX.Launcher.csproj", "GameFrameX.Launcher/"]
10-
COPY ["GameFrameX.Config/GameFrameX.Config.csproj", "GameFrameX.Config/"]
11-
COPY ["GameFrameX.Apps/GameFrameX.Apps.csproj", "GameFrameX.Apps/"]
12-
COPY ["GameFrameX.Proto/GameFrameX.Proto.csproj", "GameFrameX.Proto/"]
13-
14-
RUN dotnet restore "GameFrameX.Launcher/GameFrameX.Launcher.csproj"
15-
COPY . .
16-
WORKDIR "/src/GameFrameX.Launcher"
17-
RUN dotnet build "GameFrameX.Launcher.csproj" -c $BUILD_CONFIGURATION -o /app/build
18-
19-
FROM build AS publish
20-
ARG BUILD_CONFIGURATION=Release
21-
RUN dotnet publish "GameFrameX.Launcher.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
22-
23-
FROM base AS final
24-
WORKDIR /app
25-
COPY --from=publish /app/publish .
26-
ENTRYPOINT ["dotnet", "GameFrameX.Launcher.dll"]
1+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
2+
USER $APP_UID
3+
WORKDIR /app
4+
5+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
6+
ARG BUILD_CONFIGURATION=Release
7+
WORKDIR /src
8+
9+
COPY ["GameFrameX.Launcher/GameFrameX.Launcher.csproj", "GameFrameX.Launcher/"]
10+
COPY ["GameFrameX.Config/GameFrameX.Config.csproj", "GameFrameX.Config/"]
11+
COPY ["GameFrameX.Apps/GameFrameX.Apps.csproj", "GameFrameX.Apps/"]
12+
COPY ["GameFrameX.Proto/GameFrameX.Proto.csproj", "GameFrameX.Proto/"]
13+
COPY ["GameFrameX.Hotfix/GameFrameX.Hotfix.csproj", "GameFrameX.Hotfix/"]
14+
COPY ["GameFrameX.CodeGenerator/GameFrameX.CodeGenerator.csproj", "GameFrameX.CodeGenerator/"]
15+
16+
RUN dotnet restore "GameFrameX.Launcher/GameFrameX.Launcher.csproj"
17+
COPY . .
18+
WORKDIR "/src/GameFrameX.Launcher"
19+
RUN dotnet build "GameFrameX.Launcher.csproj" -c $BUILD_CONFIGURATION -o /app/build
20+
21+
FROM build AS publish
22+
ARG BUILD_CONFIGURATION=Release
23+
RUN dotnet publish "GameFrameX.Launcher.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
24+
RUN dotnet publish "../GameFrameX.Hotfix/GameFrameX.Hotfix.csproj" -c $BUILD_CONFIGURATION -o /app/hotfix /p:UseAppHost=false
25+
26+
FROM base AS final
27+
USER root
28+
WORKDIR /app
29+
COPY --from=publish /app/publish .
30+
COPY --from=publish /app/hotfix /app/hotfix-default
31+
32+
RUN mkdir -p /app/hotfix && \
33+
printf '#!/bin/sh\n\
34+
if [ -z "$(ls -A /app/hotfix 2>/dev/null)" ]; then\n\
35+
echo "hotfix directory is empty, copying defaults..."\n\
36+
cp -r /app/hotfix-default/* /app/hotfix/\n\
37+
fi\n\
38+
exec "$@"' > /app/entrypoint.sh && \
39+
chmod +x /app/entrypoint.sh
40+
41+
USER $APP_UID
42+
ENTRYPOINT ["/app/entrypoint.sh", "dotnet", "GameFrameX.Launcher.dll"]

0 commit comments

Comments
 (0)