YD_Event.Admin/Dockerfile

63 lines
1.6 KiB
Docker
Raw Normal View History

2026-03-02 11:08:24 +08:00
# <20><><EFBFBD><EFBFBD> .NET 8 <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
2026-02-23 18:32:49 +08:00
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 9996
2025-12-17 10:32:52 +08:00
2026-03-02 11:08:24 +08:00
# <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
2026-02-23 18:32:49 +08:00
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
2025-12-17 10:32:52 +08:00
2026-03-22 22:13:07 +08:00
# <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RUN apt-get update && apt-get install -y \
2026-03-14 07:50:18 +08:00
fonts-liberation \
fonts-dejavu-core \
2026-04-21 20:39:24 +08:00
fonts-wqy-zenhei \
fonts-wqy-microhei \
fonts-noto-cjk \
2026-03-14 07:50:18 +08:00
fontconfig \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
2026-03-22 22:13:07 +08:00
2026-03-14 07:50:18 +08:00
# <20>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD>建<EFBFBD><E5BBBA>
RUN fc-cache -fv
2026-03-02 11:08:24 +08:00
# <20><><EFBFBD><EFBFBD><EFBFBD>׶<EFBFBD>
2026-02-23 18:32:49 +08:00
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
2025-12-17 10:32:52 +08:00
2026-03-02 11:08:24 +08:00
# <20>ȿ<EFBFBD><C8BF><EFBFBD> csproj <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Docker <20><><EFBFBD><EFBFBD>
2026-02-23 18:32:49 +08:00
COPY ["YD_Event.Web.Entry/YD_Event.Web.Entry.csproj", "YD_Event.Web.Entry/"]
COPY ["YD_Event.Web.Core/YD_Event.Web.Core.csproj", "YD_Event.Web.Core/"]
COPY ["YD_Event.Application/YD_Event.Application.csproj", "YD_Event.Application/"]
COPY ["YD_Event.Core/YD_Event.Core.csproj", "YD_Event.Core/"]
2025-12-17 10:32:52 +08:00
2026-03-02 11:08:24 +08:00
# <20>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>
2026-02-23 18:32:49 +08:00
RUN dotnet restore "YD_Event.Web.Entry/YD_Event.Web.Entry.csproj"
2026-03-02 11:08:24 +08:00
# <20><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>
2025-12-17 10:32:52 +08:00
COPY . .
2026-03-02 11:08:24 +08:00
2026-02-23 18:32:49 +08:00
WORKDIR "/src/YD_Event.Web.Entry"
2026-03-02 11:08:24 +08:00
# <20><><EFBFBD><EFBFBD>
2026-02-23 18:32:49 +08:00
RUN dotnet build "YD_Event.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/build
2025-12-17 10:32:52 +08:00
2026-03-02 11:08:24 +08:00
# <20><><EFBFBD><EFBFBD>
2025-12-17 10:32:52 +08:00
FROM build AS publish
2026-02-23 18:32:49 +08:00
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "YD_Event.Web.Entry.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
2025-12-17 10:32:52 +08:00
2026-03-02 11:08:24 +08:00
# <20><><EFBFBD>о<EFBFBD><D0BE><EFBFBD>
2025-12-17 10:32:52 +08:00
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
2026-03-02 11:08:24 +08:00
# <20><><EFBFBD><EFBFBD> Kestrel <20>˿<EFBFBD>
2026-02-23 18:32:49 +08:00
ENV ASPNETCORE_URLS=http://*:9996
2026-03-02 11:08:24 +08:00
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2026-02-23 18:32:49 +08:00
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:9996/health || exit 1
2025-12-17 10:32:52 +08:00
2026-03-02 11:08:24 +08:00
ENTRYPOINT ["dotnet", "YD_Event.Web.Entry.dll"]