Create entrypoint.sh
Browse files- entrypoint.sh +20 -0
entrypoint.sh
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
# Start g4f API server in the background
|
| 5 |
+
python -m g4f --port 7860 &
|
| 6 |
+
G4F_PID=$!
|
| 7 |
+
|
| 8 |
+
# Give the server a moment to start
|
| 9 |
+
sleep 2
|
| 10 |
+
|
| 11 |
+
# Create a public HTTPS tunnel with localhost.run
|
| 12 |
+
# -o options disable host key checking since the host key changes frequently
|
| 13 |
+
ssh -o StrictHostKeyChecking=no \
|
| 14 |
+
-o UserKnownHostsFile=/dev/null \
|
| 15 |
+
-R 80:localhost:7860 \
|
| 16 |
+
nokey@localhost.run
|
| 17 |
+
|
| 18 |
+
# If the tunnel exits, clean up the server
|
| 19 |
+
kill $G4F_PID 2>/dev/null
|
| 20 |
+
wait $G4F_PID 2>/dev/null
|