Kaballas commited on
Commit
779a7d2
·
1 Parent(s): d258346
Files changed (1) hide show
  1. entrypoint.sh +3 -30
entrypoint.sh CHANGED
@@ -1,34 +1,7 @@
1
  #!/bin/bash
2
  set -e
3
 
4
- PORT=7860
5
- for arg in "$@"; do
6
- case $arg in
7
- -port) shift; PORT=$1 ;;
8
- esac
9
- done
10
 
11
- # Start sshd
12
- /usr/sbin/sshd
13
-
14
- # Start cloudflared tunnel and capture URL
15
- cloudflared tunnel --url ssh://localhost:22 --no-autoupdate 2>&1 | \
16
- grep -o 'https://[a-z0-9-]*.trycloudflare.com' | \
17
- while read url; do
18
- echo "===== SFTP Tunnel URL: ${url} ====="
19
- done &
20
-
21
- # Start HTTP health server on 7860 so HF Space stays alive
22
- echo "===== HTTP health server on port ${PORT} ====="
23
- python3 -c "
24
- import http.server, socketserver, os
25
- port = int(os.environ.get('PORT', ${PORT}))
26
- handler = http.server.BaseHTTPRequestHandler
27
- def do_GET(self):
28
- self.send_response(200)
29
- self.end_headers()
30
- self.wfile.write(b'SFTP server running')
31
- handler.do_GET = do_GET
32
- with socketserver.TCPServer(('', port), handler) as httpd:
33
- httpd.serve_forever()
34
- "
 
1
  #!/bin/bash
2
  set -e
3
 
4
+ PUBLIC_IP=$(curl -sf https://api.ipify.org || echo "unavailable")
5
+ echo "===== Public IP: ${PUBLIC_IP} ====="
 
 
 
 
6
 
7
+ exec /usr/sbin/sshd -D -e