fix: deploy.sh path detection for host execution
This commit is contained in:
@@ -1,8 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
SRC="/repo"
|
# 1. 자동 감지: Docker 컨테이너 내부인가?
|
||||||
DST="/runtime"
|
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"
|
git config --global --add safe.directory "$SRC"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user