fix: make entrypoint auto-detect binary locations
Binary paths differ between builder stages (nested in source dirs like /app/gateway/tools-gateway instead of /app/gateway). Make entrypoint search multiple candidate paths. Co-Authored-By: Kilo <kilo@kilo.ai>
This commit is contained in:
+35
-5
@@ -4,18 +4,48 @@
|
||||
|
||||
set -e
|
||||
|
||||
echo "Starting tools-gateway..."
|
||||
/app/gateway &
|
||||
# Find gateway binary (named tools-gateway or in gateway/ subdir)
|
||||
GATEWAY_BIN=""
|
||||
for candidate in /app/gateway/tools-gateway /app/gateway /app/tools-gateway /app/target/release/tools-gateway; do
|
||||
if [ -f "$candidate" ] && [ -x "$candidate" ]; then
|
||||
GATEWAY_BIN="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$GATEWAY_BIN" ]; then
|
||||
echo "ERROR: tools-gateway binary not found"
|
||||
ls -la /app/ 2>/dev/null | head -5
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find workers binary
|
||||
WORKER_BIN=""
|
||||
for candidate in /app/workers/tools-workers /app/workers /app/tools-workers /app/target/release/tools-workers; do
|
||||
if [ -f "$candidate" ] && [ -x "$candidate" ]; then
|
||||
WORKER_BIN="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$WORKER_BIN" ]; then
|
||||
echo "ERROR: tools-workers binary not found"
|
||||
ls -la /app/ 2>/dev/null | head -5
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting tools-gateway ($GATEWAY_BIN)..."
|
||||
"$GATEWAY_BIN" &
|
||||
GATEWAY_PID=$!
|
||||
|
||||
sleep 1
|
||||
|
||||
echo "Starting tools-workers..."
|
||||
/app/workers &
|
||||
echo "Starting tools-workers ($WORKER_BIN)..."
|
||||
"$WORKER_BIN" &
|
||||
WORKER_PID=$!
|
||||
|
||||
# Handle graceful shutdown
|
||||
trap "echo 'Shutting down...'; kill $GATEWAY_PID $WORKER_PID 2>/dev/null; exit 0" SIGINT SIGTERM
|
||||
trap "echo 'Shutting down...'; kill $GATEWAY_PID $WORKER_PID 2>/dev/null; wait; exit 0" SIGINT SIGTERM
|
||||
|
||||
# Wait for either process to exit
|
||||
wait -n $GATEWAY_PID $WORKER_PID
|
||||
|
||||
Reference in New Issue
Block a user