chore: exdev 배포 경로 단일화 및 서버 재구축 스크립트 추가
- Git 저장소/배포 work-tree를 /Users/aidev/apps/goldenChart로 통일 - 레거시 dev 경로는 심볼릭 링크로 흡수, deploy.sh에 소스 검증·no-cache 옵션 - server-rebuild-exdev.sh, verify-source-sync.sh 추가 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+28
-7
@@ -13,8 +13,11 @@ DOCKER_COMPOSE_FILE="${DOCKER_COMPOSE_FILE:-${WORK_TREE}/docker-compose.yml}"
|
||||
DEPLOY_LOG="${DEPLOY_LOG:-/Volumes/ADATA/logs/deploy/deploy.log}"
|
||||
LOG_TAG="[goldenChart-deploy]"
|
||||
SERVICE_NAME="${SERVICE_NAME:-all}"
|
||||
DOCKER_NO_CACHE="${DOCKER_NO_CACHE:-0}"
|
||||
BACKEND_HEALTH_URL="${BACKEND_HEALTH_URL:-http://localhost:8080/api/indicators/list}"
|
||||
FRONTEND_URL="${FRONTEND_URL:-http://localhost:80}"
|
||||
# 단일 배포 경로 (다른 work-tree 사용 금지)
|
||||
LEGACY_WORK_TREE="/Users/aidev/dev/goldenChart"
|
||||
|
||||
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:${PATH:-/usr/bin:/bin}"
|
||||
|
||||
@@ -51,23 +54,41 @@ info "[Phase 1] Git checkout"
|
||||
[ ! -d "$WORK_TREE" ] && mkdir -p "$WORK_TREE"
|
||||
[ ! -d "$GIT_DIR" ] && err "GIT_DIR 없음: $GIT_DIR"
|
||||
git --work-tree="$WORK_TREE" --git-dir="$GIT_DIR" checkout -f "$BRANCH"
|
||||
COMMIT="$(git --git-dir="$GIT_DIR" rev-parse HEAD)"
|
||||
info "체크아웃 완료: $(git --git-dir="$GIT_DIR" rev-parse --short HEAD)"
|
||||
|
||||
# work-tree 에 중첩 .git 금지 (bare checkout 과 혼선 방지)
|
||||
if [ -d "$WORK_TREE/.git" ]; then
|
||||
err "work-tree에 중첩 .git 존재 — 제거 후 재배포: rm -rf $WORK_TREE/.git"
|
||||
fi
|
||||
WT_HEAD="$(git --git-dir="$GIT_DIR" --work-tree="$WORK_TREE" rev-parse HEAD)"
|
||||
[ "$WT_HEAD" = "$COMMIT" ] || err "work-tree HEAD 불일치: $WT_HEAD != $COMMIT"
|
||||
if [ -f "$WORK_TREE/frontend/src/utils/ChartManager.ts" ]; then
|
||||
info "소스 검증 ChartManager.sha256=$(shasum -a 256 "$WORK_TREE/frontend/src/utils/ChartManager.ts" | awk '{print $1}')"
|
||||
fi
|
||||
if [ -e "$LEGACY_WORK_TREE" ] && [ ! -L "$LEGACY_WORK_TREE" ]; then
|
||||
warn "레거시 경로 존재(단일화 권장): $LEGACY_WORK_TREE — 배포는 $WORK_TREE 만 사용"
|
||||
fi
|
||||
|
||||
[ ! -f "$DOCKER_COMPOSE_FILE" ] && err "docker-compose.yml 없음: $DOCKER_COMPOSE_FILE"
|
||||
cd "$WORK_TREE"
|
||||
|
||||
# Phase 2 — Docker 이미지 빌드 (호스트 npm 사용 안 함 → postcss 홈 디렉터리 간섭 방지)
|
||||
info "[Phase 2] Docker 이미지 빌드 ($SERVICE_NAME)"
|
||||
|
||||
build_frontend() {
|
||||
info "docker compose build frontend"
|
||||
docker compose -f "$DOCKER_COMPOSE_FILE" build frontend
|
||||
_dc_build() {
|
||||
local svc="$1"
|
||||
if [ "$DOCKER_NO_CACHE" = "1" ]; then
|
||||
info "docker compose build --no-cache $svc"
|
||||
docker compose -f "$DOCKER_COMPOSE_FILE" build --no-cache "$svc"
|
||||
else
|
||||
info "docker compose build $svc"
|
||||
docker compose -f "$DOCKER_COMPOSE_FILE" build "$svc"
|
||||
fi
|
||||
}
|
||||
|
||||
build_backend() {
|
||||
info "docker compose build backend"
|
||||
docker compose -f "$DOCKER_COMPOSE_FILE" build backend
|
||||
}
|
||||
build_frontend() { _dc_build frontend; }
|
||||
build_backend() { _dc_build backend; }
|
||||
|
||||
case "$SERVICE_NAME" in
|
||||
frontend) build_frontend ;;
|
||||
|
||||
Reference in New Issue
Block a user