Files
martial-web/.drone.yml
n72595987@gmail.com 1d8d60ccaa
Some checks failed
continuous-integration/drone/push Build is failing
修复 Drone CI 配置:移除 host volumes 以解决 untrusted 仓库问题
- 移除 npm-cache volume 挂载
- 同一构建内的步骤仍可共享 node_modules
- 使用国内镜像加速依赖下载

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 17:45:39 +08:00

63 lines
1.4 KiB
YAML
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.
kind: pipeline
type: docker
name: 武术系统前端自动部署
# 只在 main 分支触发
trigger:
branch:
- main
event:
- push
steps:
# 步骤1安装依赖
- name: 安装依赖
image: node:18-alpine
commands:
- echo "开始安装 npm 依赖..."
- npm install --registry=https://registry.npmmirror.com
- echo "✅ 依赖安装完成"
# 步骤2构建生产版本
- name: 构建前端项目
image: node:18-alpine
commands:
- echo "开始构建前端项目..."
- npm run build
- ls -lh dist/
- echo "✅ 前端构建完成"
# 步骤3构建 Docker 镜像
- name: 构建Docker镜像
image: plugins/docker
settings:
repo: martial/frontend
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
dockerfile: Dockerfile
# 步骤4部署到服务器
- name: 部署到生产环境
image: appleboy/drone-ssh
settings:
host: 154.30.6.21
username: root
key:
from_secret: ssh_key
port: 22
script:
- cd /app/martial
- docker-compose pull frontend
- docker-compose up -d frontend
- docker ps | grep martial-frontend
- echo "✅ 前端部署完成"
# 步骤5健康检查
- name: 健康检查
image: curlimages/curl:latest
commands:
- sleep 5
- curl -f http://154.30.6.21:2888 || exit 1
- echo "✅ 前端访问正常"