fix(dockerfile): 移除 --no-check-certificate 並釘選 alpine:3.20

對齊上游 actions/code-review:保留套件來源 TLS 憑證驗證、釘選明確基底版本以確保建置可重現。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jeffery
2026-06-26 15:46:27 +08:00
co-authored by Claude Opus 4.8
parent 11551f8f58
commit d4d02638b9
+5 -8
View File
@@ -6,18 +6,15 @@
# 更新日期:2026/06/26 11:34:46
# =============================================================================
# 指定基底映像為 Alpine Linux 最新版;Alpine 體積小,可縮小最終映像大小並加快拉取速度
# 需人工確認:使用 latest tag 會在不同時間建置出不同基底版本,可能影響可重現性,
# 建議釘選明確版本(例如 alpine:3.20)以確保建置一致。
FROM alpine:latest
# 指定基底映像為 Alpine Linux 3.20(釘選明確版本以確保建置可重現,與上游 actions/code-review 一致)
# Alpine 體積小,可縮小最終映像大小並加快拉取速度。
FROM alpine:3.20
# 安裝必要的工具
# 安裝執行 code review 所需的工具:bash(執行 entrypoint 腳本)、git(前置遠端驗證/取得 diff)、
# nodejs 與 npm(執行 app 內的 Node.js 程式)。
# --no-cache:不保留 apk 套件索引快取,避免殘留在映像層中以減少映像大小。
# 需人工確認:--no-check-certificate 會略過套件來源的憑證驗證,存在中間人攻擊風險,
# 僅在內網或憑證受限環境下使用;正式環境建議移除以維持安全性。
RUN apk add --no-cache --no-check-certificate bash git nodejs npm
# 已移除 --no-check-certificate:保留套件來源 TLS 憑證驗證以防中間人攻擊(標準 alpine 來源憑證有效,上游亦未使用此旗標)。
RUN apk add --no-cache bash git nodejs npm
# 將專案的 app/ 目錄複製到映像內的 /app;包含 Node.js 程式碼與 package.json 等相依宣告。
COPY ./app /app