From 64c526488a278f03571add54190b7d5391e5d322 Mon Sep 17 00:00:00 2001 From: gahusb Date: Sun, 25 Jan 2026 19:10:23 +0900 Subject: [PATCH] fix: deploy-nas.sh path detection for host execution --- scripts/deploy-nas.sh | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/scripts/deploy-nas.sh b/scripts/deploy-nas.sh index b612a30..e94c64b 100644 --- a/scripts/deploy-nas.sh +++ b/scripts/deploy-nas.sh @@ -1,10 +1,30 @@ #!/bin/bash set -euo pipefail -# deployer 컨테이너 내부에서는 /repo, /runtime 사용 -# 호스트 수동 실행 시에는 환경변수($REPO_PATH, $RUNTIME_PATH) 또는 아래 기본값 사용 -SRC="${REPO_PATH:-/repo}" -DST="${RUNTIME_PATH:-/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:-}" + + if [ -z "$DST" ]; then + echo "Error: RUNTIME_PATH is not set. Please create .env file with RUNTIME_PATH defined." + exit 1 + fi +fi + +echo "Source: $SRC" +echo "Target: $DST" cd "$SRC"