From a00f63d7beeed551d2c167b8f7933ff7e821fabc Mon Sep 17 00:00:00 2001 From: xiangning Date: Fri, 17 Jul 2026 13:59:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(docker):=20=E8=AE=BE=20ENV=20CI=3Dtrue=20?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=20lefthook=20prepare=20=E9=92=A9=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docker build 无 .git 目录,lefthook install 报 fatal:not a git repository。 设 CI=true 让 is-ci 短路,prepare 脚本(is-ci || lefthook install)跳过 lefthook。 --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ad9b34d..1db1d04 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,8 +4,10 @@ FROM 43.134.235.58:58080/dockerhub-proxy/library/node:22-alpine AS builder WORKDIR /app -# 装 git:lefthook 的 prepare 钩子(is-ci || pnpm exec lefthook install)需要 git +# 装 git + 设 CI=true:lefthook 的 prepare 钩子(is-ci || lefthook install)在 CI 环境 +# 会因 is-ci 短路跳过;docker build 无 .git 目录,lefthook install 会 fatal RUN apk add --no-cache git +ENV CI=true # 全局装 pnpm(与本地 11.x 对齐;corepack 在 alpine 上不可靠) RUN npm install -g pnpm@11