Asem123 commited on
Commit
c9de619
·
verified ·
1 Parent(s): 21f40bd

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +8 -18
start.sh CHANGED
@@ -4,25 +4,15 @@ set -e
4
  echo "[start.sh] PORT=${PORT:-7860}"
5
  echo "[start.sh] starting health server ..."
6
 
7
- # 1) 占住 $PORT,让 HF 健康检查返回 200
8
  node -e 'require("http")
9
  .createServer((req,res)=>{res.writeHead(200,{"Content-Type":"text/plain"});res.end("MiGPT-Next is running")})
10
  .listen(process.env.PORT||7860)' &
11
 
12
- # 2) 用镜像原生入口 + 必要参数启动 MiGPT-Next
13
- if [ -x /usr/local/bin/docker-entrypoint.sh ]; then
14
- echo "[start.sh] exec /usr/local/bin/docker-entrypoint.sh node"
15
- exec /usr/local/bin/docker-entrypoint.sh node
16
- fi
17
-
18
- # 3) 兜底:找常见主文件,或直接用包启动
19
- for main in /app/index.js /app/server.js /app/dist/index.js; do
20
- if [ -f "$main" ]; then
21
- echo "[start.sh] fallback: node $main"
22
- exec node "$main"
23
- fi
24
- done
25
-
26
- # 兜底2:直接调包(镜像内已包含 @mi-gpt/next)
27
- echo "[start.sh] fallback: import('@mi-gpt/next') with /app/config.js"
28
- exec node -e ";(async()=>{const {MiGPT}=await import('@mi-gpt/next');const c=(await import('/app/config.js')).default;await MiGPT.start(c)})()"
 
4
  echo "[start.sh] PORT=${PORT:-7860}"
5
  echo "[start.sh] starting health server ..."
6
 
7
+ # 1) 占住 $PORT:给 HF 健康检查一个 200 OK
8
  node -e 'require("http")
9
  .createServer((req,res)=>{res.writeHead(200,{"Content-Type":"text/plain"});res.end("MiGPT-Next is running")})
10
  .listen(process.env.PORT||7860)' &
11
 
12
+ # 2) 直接启动 MiGPT-Next(用 @mi-gpt/next + /app/config.js)
13
+ echo "[start.sh] start MiGPT via @mi-gpt/next"
14
+ exec node - <<'JS'
15
+ import { MiGPT } from '@mi-gpt/next';
16
+ const cfg = (await import('/app/config.js')).default;
17
+ await MiGPT.start(cfg);
18
+ JS