fix: deploy-nas.sh path detection for host execution
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user