This commit is contained in:
2026-03-15 22:29:11 +08:00
parent 2c2617e219
commit 085e4b76c5
2 changed files with 63 additions and 10 deletions
+22 -1
View File
@@ -82,6 +82,8 @@ show_usage() {
echo " -m, --models DIR 指定模型目录路径"
echo " -p, --port PORT 指定服务端口"
echo " -b, --branch NAME 指定 Git 分支(默认:main)"
echo " --http-proxy URL 指定构建时的 HTTP 代理 (例如: http://192.168.0.10:7890)"
echo " --socks-proxy HOST:PORT 指定构建时的 SOCKS 代理 (例如: 192.168.0.10:1080)"
echo " -h, --help 显示此帮助信息"
echo ""
echo "示例:"
@@ -98,6 +100,8 @@ FORCE_BUILD=false
STOP_ONLY=false
DETACH=true
CUSTOM_CONFIG=""
HTTP_PROXY_ARG=""
SOCKS_PROXY_ARG=""
CUSTOM_MODELS=""
CUSTOM_PORT=""
@@ -107,6 +111,14 @@ while [[ $# -gt 0 ]]; do
FORCE_BUILD=true
shift
;;
--http-proxy)
HTTP_PROXY_ARG="$2"
shift 2
;;
--socks-proxy)
SOCKS_PROXY_ARG="$2"
shift 2
;;
-s|--stop)
STOP_ONLY=true
shift
@@ -265,7 +277,16 @@ build_image() {
BUILD_START=$(date +%s)
if docker build --network=host --build-arg MAX_JOBS=32 -t "${IMAGE_NAME}:${IMAGE_TAG}" .; then
# 准备构建参数
BUILD_ARGS="--network=host --build-arg MAX_JOBS=32"
if [ -n "$HTTP_PROXY_ARG" ]; then
BUILD_ARGS="${BUILD_ARGS} --build-arg HTTP_PROXY=${HTTP_PROXY_ARG} --build-arg HTTPS_PROXY=${HTTP_PROXY_ARG}"
fi
if [ -n "$SOCKS_PROXY_ARG" ]; then
BUILD_ARGS="${BUILD_ARGS} --build-arg SOCKS_PROXY=${SOCKS_PROXY_ARG}"
fi
if docker build ${BUILD_ARGS} -t "${IMAGE_NAME}:${IMAGE_TAG}" .; then
BUILD_END=$(date +%s)
BUILD_TIME=$((BUILD_END - BUILD_START))