mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-05-11 18:10:06 +08:00
feat(deploy): 添加 nginx 反向代理配置并优化前端构建流程
- 新增 nginx 配置模板,用于前端服务的反向代理 - 更新 Dockerfile,使用 pnpm 替代 npm 并添加 nginx 配置 - 添加启动脚本,实现后端健康检查和动态配置 nginx - 更新 .env.example,为后端主机添加注释说明 - 优化 docker-compose.yml,明确版本号并调整服务依赖
This commit is contained in:
@@ -1,13 +1,32 @@
|
||||
# === 前端构建阶段 ===
|
||||
FROM node:18-alpine AS build
|
||||
|
||||
# 安装 pnpm
|
||||
RUN npm install -g pnpm
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 拷贝前端源码
|
||||
COPY ./BillNote_frontend /app
|
||||
|
||||
RUN npm install && npm run build
|
||||
# 安装依赖并构建
|
||||
RUN pnpm install && pnpm run build
|
||||
|
||||
# === nginx 运行阶段 ===
|
||||
FROM nginx:alpine
|
||||
|
||||
# 拷贝模板配置
|
||||
COPY ./BillNote_frontend/deploy/default.conf.template /etc/nginx/templates/default.conf.template
|
||||
|
||||
# 拷贝构建产物
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
|
||||
# 拷贝启动脚本
|
||||
COPY ./BillNote_frontend/deploy/start.sh /start.sh
|
||||
RUN chmod +x /start.sh
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
# 使用启动脚本启动容器
|
||||
CMD ["/start.sh"]
|
||||
Reference in New Issue
Block a user