Files
lp-terminal/docker-entrypoint.sh
2026-07-19 03:59:49 +08:00

22 lines
598 B
Bash

#!/bin/sh
# 单容器双进程启动:indexer(后台)+ preview(前台)
# 任一进程退出都让容器退出,交给 docker/compose 的 restart 策略重启
set -e
cd /app
# 后台跑 indexer
echo "[entrypoint] starting lp-indexer on :8787"
npm run indexer &
INDEXER_PID=$!
# 前台跑 preview(--host 0.0.0.0 暴露到容器外)
echo "[entrypoint] starting lp-web (preview) on :4173"
npm run preview -- --host 0.0.0.0 --port 4173 &
WEB_PID=$!
# 任一进程退出就整体退出
trap 'echo "[entrypoint] process exited, shutting down"; kill $INDEXER_PID $WEB_PID 2>/dev/null; exit 1' CHLD
wait