260324:1018 fix ci-deploy : optimize #04
CI / CD Pipeline / build (push) Successful in 7m45s
CI / CD Pipeline / deploy (push) Failing after 1m13s

This commit is contained in:
admin
2026-03-24 10:18:19 +07:00
parent 2d13618154
commit 1a2b7ead65
+15 -3
View File
@@ -68,6 +68,18 @@ echo "✓ Images built successfully"
# Ensure target environment directory exists # Ensure target environment directory exists
mkdir -p "$LCBP3_DIR/$TARGET" mkdir -p "$LCBP3_DIR/$TARGET"
# Copy compose file from source to target directory
SOURCE_COMPOSE="/share/np-dms/app/source/lcbp3/specs/04-Infrastructure-OPS/04-00-docker-compose/docker-compose-app.yml"
TARGET_COMPOSE="$LCBP3_DIR/$TARGET/docker-compose.yml"
if [ -f "$SOURCE_COMPOSE" ]; then
cp "$SOURCE_COMPOSE" "$TARGET_COMPOSE"
echo "✓ Compose file copied to $TARGET environment"
else
echo "✗ Source compose file not found at $SOURCE_COMPOSE"
exit 1
fi
# Move correctly to target directory for docker-compose up # Move correctly to target directory for docker-compose up
cd "$LCBP3_DIR/$TARGET" cd "$LCBP3_DIR/$TARGET"
@@ -89,7 +101,7 @@ echo "[5/9] Waiting for services to be healthy..."
sleep 15 sleep 15
# Check backend health with proper container name # Check backend health with proper container name
BACKEND_CONTAINER="lcbp3-${TARGET}-backend" BACKEND_CONTAINER="backend"
for i in {1..30}; do for i in {1..30}; do
if docker exec "$BACKEND_CONTAINER" curl -f http://localhost:3000/health > /dev/null 2>&1 || \ if docker exec "$BACKEND_CONTAINER" curl -f http://localhost:3000/health > /dev/null 2>&1 || \
docker exec "$BACKEND_CONTAINER" curl -f http://localhost:3000/ping > /dev/null 2>&1; then docker exec "$BACKEND_CONTAINER" curl -f http://localhost:3000/ping > /dev/null 2>&1; then
@@ -154,8 +166,8 @@ sleep 5
VERIFY_SUCCESS=false VERIFY_SUCCESS=false
# Method 1: Via NGINX container internal check # Method 1: Via NGINX container internal check
if docker exec "$NGINX_CONTAINER" curl -f -k http://lcbp3-${TARGET}-backend:3000/health > /dev/null 2>&1 || \ if docker exec "$NGINX_CONTAINER" curl -f -k http://backend:3000/health > /dev/null 2>&1 || \
docker exec "$NGINX_CONTAINER" curl -f -k http://lcbp3-${TARGET}-backend:3000/ping > /dev/null 2>&1; then docker exec "$NGINX_CONTAINER" curl -f -k http://backend:3000/ping > /dev/null 2>&1; then
echo "✓ New environment is responding via internal network" echo "✓ New environment is responding via internal network"
VERIFY_SUCCESS=true VERIFY_SUCCESS=true
fi fi