Spaces:
Paused
Paused
Update entrypoint.sh
Browse files- entrypoint.sh +25 -1
entrypoint.sh
CHANGED
|
@@ -1 +1,25 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
# (任意) venv を使っているなら有効化
|
| 5 |
+
if [ -f "/home/user/app/.venv/bin/activate" ]; then
|
| 6 |
+
source /home/user/app/.venv/bin/activate
|
| 7 |
+
fi
|
| 8 |
+
|
| 9 |
+
# HF Spaces / Gradio の公開設定(超重要)
|
| 10 |
+
export GRADIO_SERVER_NAME="${GRADIO_SERVER_NAME:-0.0.0.0}"
|
| 11 |
+
export GRADIO_SERVER_PORT="${GRADIO_SERVER_PORT:-7860}"
|
| 12 |
+
export PORT="${PORT:-7860}"
|
| 13 |
+
|
| 14 |
+
# robot-server を使うなら起動(devが永遠に走るならバックグラウンド化)
|
| 15 |
+
if [ -d "/root/opentrons/robot-server" ]; then
|
| 16 |
+
echo "[entrypoint] starting robot-server..."
|
| 17 |
+
# dev が foreground で張り付く想定なのでバックグラウンドに回す
|
| 18 |
+
(cd /root/opentrons && make -C robot-server dev) &
|
| 19 |
+
ROBOT_SERVER_PID=$!
|
| 20 |
+
echo "[entrypoint] robot-server pid=${ROBOT_SERVER_PID}"
|
| 21 |
+
fi
|
| 22 |
+
|
| 23 |
+
# ここで Gradio/HTTP をフォアグラウンドで起動(exec が重要)
|
| 24 |
+
echo "[entrypoint] starting main app..."
|
| 25 |
+
exec python /home/user/app/main.py
|