Files
web/pull-and-restart.sh

27 lines
882 B
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
# 拉取代码并重启项目(线上项目根目录:/home/yxd/project/yh_web
# 行尾LF.gitattributes
# 用法cd /home/yxd/project/yh_web && ./pull-and-restart.sh
# 或指定目录PROJECT_ROOT=/home/yxd/project/yh_web ./pull-and-restart.sh
set -e
ROOT="${PROJECT_ROOT:-$(cd "$(dirname "$0")" && pwd)}"
cd "$ROOT"
echo "=========================================="
echo " yh_web 拉取并重启"
echo " 路径: $ROOT"
echo "=========================================="
[ -f server/.env ] && set -a && source server/.env && set +a
echo "[1/2] 拉取代码..."
git pull
echo ""
echo "[2/2] 重新构建并启动..."
docker compose build --no-cache 2>/dev/null || docker-compose build --no-cache
docker compose up -d --force-recreate 2>/dev/null || docker-compose up -d --force-recreate
echo ""
echo "完成. api:9527 web:9528 admin:9529"