690319:2309 Update Backend & Frontend dep. #03
Build and Deploy / deploy (push) Has been cancelled

This commit is contained in:
2026-03-19 23:09:44 +07:00
parent 29b5b42f78
commit e9b5ae28ec
2 changed files with 232 additions and 4 deletions
+25 -4
View File
@@ -17,8 +17,8 @@ jobs:
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
timeout: 900s # 15 minutes total timeout
command_timeout: 600s # 10 minutes per command timeout
timeout: 1200s # 20 minutes total timeout (เพิ่มจาก 15 นาที)
command_timeout: 900s # 15 minutes per command timeout (เพิ่มจาก 10 นาที)
script_stop_signal: true # Stop script on error
script: |
set -e
@@ -49,8 +49,25 @@ jobs:
# Sync compose file จาก repo → app directory
cp /share/np-dms/app/source/lcbp3/specs/04-Infrastructure-OPS/04-00-docker-compose/docker-compose-app.yml /share/np-dms/app/docker-compose-app.yml
cd /share/np-dms/app
# ⚠️ ลบ container เดิมที่อาจสร้างจาก Container Station
# ⚠️ ลบ container เดิมที่อาจสร้างจาก Container Station - พยายามหลายวิธี
echo "🧹 Cleaning up existing containers..."
docker stop backend frontend 2>/dev/null || true
sleep 5
docker rm -f backend frontend 2>/dev/null || true
sleep 3
# ถ้ายังลบไม่ได้ ลอง force remove ด้วย container ID
for container in backend frontend; do
if docker ps -a --format "{{.Names}}" | grep -q "^${container}$"; then
echo "🔧 Force removing container: $container"
container_id=$(docker ps -a --filter "name=$container" --format "{{.ID}}")
if [ ! -z "$container_id" ]; then
docker rm -f "$container_id" 2>/dev/null || true
sleep 2
fi
fi
done
# 4a. Start Backend ก่อน
echo "🟢 Starting Backend..."
@@ -80,7 +97,11 @@ jobs:
docker compose -f docker-compose-app.yml up -d frontend
# 5. Cleanup
echo "🧹 Cleaning up unused images..."
echo "🧹 Cleaning up unused images and containers..."
docker image prune -f
docker system prune -f --volumes 2>/dev/null || true
echo "📊 Final container status:"
docker ps -a
echo "✅ Deployment Complete!"