Some checks failed
continuous-integration/drone/push Build encountered an error
1. 新增 .drone.yml 配置文件 - 自动安装 npm 依赖 - 自动构建生产版本 - 构建 Docker 镜像 - 自动部署到生产服务器 - 健康检查验证部署成功 2. 新增 Dockerfile - 多阶段构建:Node 编译 + Nginx 运行 - 优化镜像体积,使用 alpine 基础镜像 - 配置静态资源缓存 - 添加健康检查 3. 新增 nginx.conf - 配置前端路由支持(Vue Router history 模式) - 代理 API 请求到后端服务 - 优化 Gzip 压缩和静态资源缓存 - 支持 BladeX 系统模块路径代理 现在推送代码后,前端会自动部署到生产环境! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.4 KiB
Nginx Configuration File
48 lines
1.4 KiB
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name localhost;
|
||
|
||
# 前端静态文件目录
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
# Gzip 压缩
|
||
gzip on;
|
||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||
|
||
# 前端路由(Vue Router history 模式)
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
|
||
# API 代理到后端
|
||
location /api/ {
|
||
proxy_pass http://martial-backend:8123/api/;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
}
|
||
|
||
# BladeX 系统模块代理
|
||
location /blade-auth/ {
|
||
proxy_pass http://martial-backend:8123/blade-auth/;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
}
|
||
|
||
location /blade-system/ {
|
||
proxy_pass http://martial-backend:8123/blade-system/;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
}
|
||
|
||
# 缓存静态资源
|
||
location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|ttf|svg)$ {
|
||
expires 7d;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
}
|