Spaces:
Paused
Paused
Download entrypoint.sh from onlyrickroll/opcl6: direct link, hf CLI and curl.
- Browser
- Download file 920 Bytes
-
https://huggingface.co/spaces/onlyrickroll/opcl6/resolve/main/entrypoint.sh
- Command line
-
hf download hf://spaces/onlyrickroll/opcl6/entrypoint.sh
-
curl -L -o entrypoint.sh https://huggingface.co/spaces/onlyrickroll/opcl6/resolve/main/entrypoint.sh
920 Bytes
| # 1. 启动 SSH 服务 | |
| # 注意:使用绝对路径,且不需要加 -D,因为我们用 & 把它放后台 | |
| /usr/sbin/sshd -D -e 2>&1 & | |
| echo "SSHD started on port 2222..." | |
| # 2. 启动 Nginx | |
| # nginx 默认会在后台运行,但这里我们用 & 确保它不阻塞后续脚本 | |
| #nginx & | |
| # 3. 启动 Cloudflare Tunnel | |
| if [ -z "$TUNNEL_TOKEN" ]; then | |
| echo "Warning: TUNNEL_TOKEN is not set. Cloudflare Tunnel will not start." | |
| echo "You can still access the web UI via Hugging Face port 7860." | |
| # 如果没有 Tunnel,我们需要一个前台进程防止容器退出 | |
| # 这里我们让 nginx 重新到前台运行,或者直接 wait | |
| wait | |
| else | |
| echo "Starting Cloudflare Tunnel..." | |
| # cloudflared 会作为前台进程运行,保持容器不退出 | |
| nohup cloudflared tunnel --protocol http2 --loglevel error --no-autoupdate run --token "$TUNNEL_TOKEN" & | |
| fi | |
| nginx -g "daemon off;" | |