Files
BiliNote/BillNote_frontend/deploy/start.sh
Jefferyhcool 517bf04720 feat(deploy): 添加 nginx 反向代理配置并优化前端构建流程
- 新增 nginx 配置模板,用于前端服务的反向代理
- 更新 Dockerfile,使用 pnpm 替代 npm 并添加 nginx 配置
- 添加启动脚本,实现后端健康检查和动态配置 nginx
- 更新 .env.example,为后端主机添加注释说明
- 优化 docker-compose.yml,明确版本号并调整服务依赖
2025-04-16 02:04:16 +08:00

20 lines
808 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
###
# @Author: Jefferyhcool 1063474837@qq.com
# @Date: 2025-04-16 01:57:05
# @LastEditors: Jefferyhcool 1063474837@qq.com
# @LastEditTime: 2025-04-16 01:59:37
# @FilePath: /hotfix-dev/BillNote_frontend/deploy/start.sh
# @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
###
# 等待后端健康检查通过
until curl -s "http://backend:${BACKEND_PORT}/health" > /dev/null; do
echo "等待后端服务就绪..."
sleep 2
done
# 生成 nginx 配置文件(动态变量替换)
envsubst '${BACKEND_HOST} ${BACKEND_PORT}' < /etc/nginx/templates/default.conf.template > /etc/nginx/conf.d/default.conf
# 启动 Nginx在前台运行
exec nginx -g 'daemon off;'