Feat: Entrypoint runs both Next.js and worker process

This commit is contained in:
2026-03-15 13:09:33 -07:00
parent 79d465eb88
commit 7e1b133344

19
entrypoint.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
echo "[Entrypoint] Starting Kalbot worker..."
node worker.js &
WORKER_PID=$!
echo "[Entrypoint] Starting Next.js server..."
node server.js &
SERVER_PID=$!
# Trap signals and forward to both processes
trap "kill $WORKER_PID $SERVER_PID 2>/dev/null; exit 0" SIGTERM SIGINT
# Wait for either to exit
wait -n
EXIT_CODE=$?
echo "[Entrypoint] A process exited with code $EXIT_CODE. Shutting down..."
kill $WORKER_PID $SERVER_PID 2>/dev/null
exit $EXIT_CODE