-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 873 Bytes
/
Dockerfile
File metadata and controls
32 lines (22 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 1️. Build stage(建置階段)
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /app
# 一次複製整個專案目錄,確保所有相依專案都在
COPY . ./
# 還原 NuGet 套件(確保 nuget.config 存在)
RUN dotnet restore Poker.CMS.Report.Api.sln --configfile nuget.config
# 建置並加入 Git commit hash 到版本資訊
RUN dotnet publish Poker.CMS.Report.Api.sln -c Release -o /app/publish --no-restore \
-p:ContinuousIntegrationBuild=true
# 2️. Runtime stage(運行階段)
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
# 安裝字型相關套件
RUN apt-get update && apt-get install -y \
fontconfig \
fonts-noto-cjk \
&& rm -rf /var/lib/apt/lists/*
# 更新字型快取確保字型可用
RUN fc-cache -fv
WORKDIR /app
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "Poker.CMS.Report.Api.dll"]