# ============================================================================ # 用途:Docker 容器 action 的建置檔,以 Node 24 Alpine 為基底安裝 git 與 # ca-certificates,並將 action 原始碼與進入點腳本複製進容器、設定執行進入點。 # 更新時間:2026/08/07 13:51:53 # ============================================================================ # 使用 Node 24 的 Alpine 精簡映像檔作為基底,提供 node 執行環境並縮小最終映像檔體積 FROM node:24-alpine # 安裝 git 與 ca-certificates:action 執行期需要 clone/操作 git 倉庫,且透過 HTTPS 呼叫外部 API 時需要憑證驗證;--no-cache 可避免留下 apk 索引快取、進一步縮小映像檔 RUN apk add --no-cache git ca-certificates # 複製 action 主程式原始碼到容器內的 /action/src/,供 entrypoint 執行時呼叫 COPY src/ /action/src/ # 複製容器啟動時要執行的進入點腳本到 /action/entrypoint.sh COPY entrypoint.sh /action/entrypoint.sh # 賦予 entrypoint.sh 執行權限,確保容器啟動時能直接執行該腳本 RUN chmod +x /action/entrypoint.sh # 設定容器的進入點為 entrypoint.sh,容器啟動時會執行此腳本作為 action 的入口 ENTRYPOINT ["/action/entrypoint.sh"]