From 850920155ad4fddabaf3ec110576eb94d1761bfd Mon Sep 17 00:00:00 2001 From: JianFeeeee Date: Thu, 15 Oct 2026 13:01:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8D=E9=83=A8=E7=BD=B2=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E5=8D=A0=E6=BB=A1=E4=B8=B4=E6=97=B6=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index 07009a1..5443a61 100755 --- a/deploy.sh +++ b/deploy.sh @@ -36,8 +36,15 @@ readonly REPO_DIR="/home/program/llmsproxy" readonly HEALTH_URL="http://127.0.0.1:8081/v1/models" readonly BIN_NAME="llmsproxy" -# 构建目录在 /tmp(tmpfs 更快) -readonly TMP_DIR="/tmp/llmsproxy-deploy" +# 构建目录。默认落在仓库下的构建工作区,而不是 /tmp:本机 /tmp 是 8.8G +# tmpfs,实测被 Go 构建缓存占满后会让 go test/build 在链接阶段直接失败。 +# 可用 LLMSPROXY_BUILD_DIR 覆盖;同一目录也被测试用作 GOTMPDIR。 +readonly BUILD_SUBDIR=".build-work" +if [[ -n "${LLMSPROXY_BUILD_DIR:-}" ]]; then + readonly TMP_DIR="${LLMSPROXY_BUILD_DIR}" +else + readonly TMP_DIR="${REPO_DIR}/${BUILD_SUBDIR}" +fi # 同文件系统暂存文件(用于原子 rename) readonly STAGING_BIN="${TARGET_BIN}.staging" readonly STAGING_CONFIG="${TARGET_CONFIG}.staging" @@ -142,7 +149,7 @@ build() { mkdir -p "$TMP_DIR/bin" cd "$REPO_DIR" - CGO_ENABLED=1 go build -tags luajit \ + CGO_ENABLED=1 GOTMPDIR="$TMP_DIR" go build -tags luajit \ -trimpath \ -ldflags="-s -w" \ -o "$TMP_DIR/bin/$BIN_NAME" \