From e1c3168d5cb692b593d99ce32ebdd232abcfb8d5 Mon Sep 17 00:00:00 2001 From: gahusb Date: Mon, 26 Jan 2026 00:01:08 +0900 Subject: [PATCH] fix: deploy.sh path detection for host execution --- scripts/deploy.sh | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 3ce88b8..7f478c2 100644 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,8 +1,30 @@ #!/bin/bash set -euo pipefail -SRC="/repo" -DST="/runtime" +# 1. 자동 감지: Docker 컨테이너 내부인가? +if [ -d "/repo" ] && [ -d "/runtime" ]; then + echo "Detected Docker Container environment." + SRC="/repo" + DST="/runtime" +else + # 2. Host 환경: .env 로드 시도 + if [ -f ".env" ]; then + echo "Loading .env file..." + set -a; source .env; set +a + fi + + # 환경변수가 없으면 현재 디렉토리를 SRC로 + SRC="${REPO_PATH:-$(pwd)}" + DST="${RUNTIME_PATH:-/volume1/docker/webpage}" # 기본값 설정 + + if [ -z "$DST" ]; then + echo "Error: RUNTIME_PATH is not set." + exit 1 + fi +fi + +echo "Source: $SRC" +echo "Target: $DST" git config --global --add safe.directory "$SRC"