opcl / entrypoint.sh
onlyrickroll's picture
Update entrypoint.sh
c4ff870 verified
Raw History Blame Contribute Delete
886 Bytes
#!/bin/sh
# 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 --no-autoupdate run --token "$TUNNEL_TOKEN" &
fi
nginx -g "daemon off;"