update
This commit is contained in:
18
entrypoint.sh
Normal file
18
entrypoint.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
# 前端运行期入口:同容器内先后拉起
|
||||
# 1) node standalone server(Astro 构建产物,监听 127.0.0.1:3000,承载 SSR 详情页/静态资源)
|
||||
# 2) nginx(监听 80,反代 / 到 node、/api 到 backend:8090)
|
||||
set -e
|
||||
|
||||
# node server 后台运行;一旦退出,整个容器随之退出(便于编排器感知故障)
|
||||
node ./dist/server/entry.mjs &
|
||||
NODE_PID=$!
|
||||
|
||||
# 捕获 SIGTERM/SIGINT 优雅关闭 node 与 nginx
|
||||
trap 'kill -TERM $NODE_PID 2>/dev/null; nginx -s stop 2>/dev/null; exit 0' TERM INT
|
||||
|
||||
# nginx 前台运行(容器主进程)
|
||||
nginx -g 'daemon off;' &
|
||||
NGINX_PID=$!
|
||||
|
||||
wait -n
|
||||
Reference in New Issue
Block a user