Files
ai_site/start.sh
2026-07-31 10:20:46 +08:00

46 lines
1.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# AI 建站 — Linux 一键启动Docker Compose
# 用法cd 项目根 && ./start.sh [--rebuild] [--no-pull]
# 默认从 Gitea 拉取最新代码再启动(可用 --no-pull / AIJZ_SKIP_GIT_PULL=1 跳过)
# 行尾LF
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$ROOT"
# shellcheck disable=SC1091
. "$ROOT/scripts/lib-aijz-deploy.sh"
REBUILD=0
DO_PULL=1
for a in "$@"; do
case "$a" in
--rebuild|-r) REBUILD=1 ;;
--no-pull) DO_PULL=0 ;;
--pull) DO_PULL=1 ;;
-h|--help)
echo "用法: $0 [--rebuild] [--no-pull|--pull]"
echo " 默认拉取: ${AIJZ_GIT_URL:-https://gitea.yuxindazhineng.com/whm/ai_site.git} 分支 ${GIT_BRANCH:-main}"
echo " 跳过拉取: --no-pull 或 AIJZ_SKIP_GIT_PULL=1"
exit 0
;;
esac
done
if [ "${AIJZ_SKIP_GIT_PULL:-0}" = "1" ]; then
DO_PULL=0
fi
echo "========================================"
echo " AI 建站 启动"
echo " 路径: $ROOT"
echo "========================================"
if [ "$DO_PULL" = "1" ]; then
git_pull_hard
else
echo "已跳过代码拉取(--no-pull / AIJZ_SKIP_GIT_PULL"
fi
ensure_docker
stack_up "$REBUILD"
healthcheck
print_endpoints