#!/bin/bash # Chạy backend Passport Check + Extractor + Caddy trong 1 container. Một cái chết thì thoát hết để HF tự khởi động lại. cd /app pids=() ( cd /app/passport-server && PORT=8080 exec node apps/server/dist/server.js ) & pids+=($!) ( cd /app/extractor && PORT=3001 HOST=127.0.0.1 exec node server/index.js ) & pids+=($!) caddy run --config /app/Caddyfile --adapter caddyfile & pids+=($!) trap 'kill "${pids[@]}" 2>/dev/null; exit 0' TERM INT wait -n echo "Một tiến trình đã thoát — dừng container." >&2 kill "${pids[@]}" 2>/dev/null exit 1