fix: Nginx port conflict with legacy containers
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 14m45s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 14m45s
This commit is contained in:
@@ -51,8 +51,8 @@ jobs:
|
||||
OLD_TARGET="green"
|
||||
fi
|
||||
|
||||
# 공통 인프라 (DB, Redis 등) 띄우기
|
||||
ACTIVE_PROFILE=dev docker compose up -d redis mci-mock dozzle nginx
|
||||
# 3.5. 공통 인프라 (DB, Redis 등) 먼저 띄우기 (Nginx 제외)
|
||||
ACTIVE_PROFILE=dev docker compose up -d redis mci-mock dozzle
|
||||
|
||||
# 4. 신규 버전(TARGET) 컨테이너 기동
|
||||
echo "Building and starting $TARGET containers..."
|
||||
@@ -63,6 +63,24 @@ jobs:
|
||||
tool-other-$TARGET \
|
||||
tool-payment-$TARGET
|
||||
|
||||
# 4.5. 레거시 컨테이너 청소 (포트 충돌 방지, Nginx 제외)
|
||||
echo "Finding and killing legacy containers holding our ports..."
|
||||
for port in 8281 8282 8283 8284 8285; do
|
||||
cid=$(docker ps -q --filter "publish=$port" --filter "name!=nginx")
|
||||
if [ ! -z "$cid" ]; then
|
||||
echo "Force killing legacy container $cid using port $port"
|
||||
docker rm -f $cid
|
||||
fi
|
||||
done
|
||||
|
||||
# 4.6. Nginx 초기 설정 및 기동
|
||||
mkdir -p ./nginx/conf.d
|
||||
if [ ! -f "./nginx/conf.d/default.conf" ]; then
|
||||
echo "Initializing Nginx config to $TARGET..."
|
||||
cp ./nginx/${TARGET}.conf ./nginx/conf.d/default.conf
|
||||
fi
|
||||
ACTIVE_PROFILE=dev docker compose up -d nginx
|
||||
|
||||
# 5. 헬스 체크 대기 (Spring Boot 기동 시간 확보)
|
||||
echo "Waiting 30 seconds for Spring Boot to start..."
|
||||
sleep 30
|
||||
|
||||
Reference in New Issue
Block a user