fix: deploy.sh path detection for host execution

This commit is contained in:
2026-01-26 00:01:08 +09:00
parent 2d5972c25d
commit e1c3168d5c

View File

@@ -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"