Files
012-kaopeilian/.drone.yml
yuliang_guo 0e5e6481ef
All checks were successful
continuous-integration/drone/push Build is passing
feat: 更新 CI/CD 和文档,添加崔曦文(cxw)租户
- .drone.yml: 添加 cxw-backend 到生产部署列表
- CONTEXT.md: 添加租户端口分配表,包含 cxw
2026-01-27 10:48:29 +08:00

139 lines
3.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: deploy-test
# 测试环境test 分支触发,部署到生产服务器的开发环境
trigger:
branch:
- test
event:
- push
steps:
- name: sync-code
image: appleboy/drone-ssh
settings:
host: 120.79.247.16
username: root
password:
from_secret: prod_ssh_password
port: 22
command_timeout: 5m
script:
- echo "=== 同步代码到测试环境 ==="
- cd /root/aiedu
- git fetch origin
- git checkout test 2>/dev/null || git checkout -b test origin/test
- git reset --hard origin/test
- echo "代码同步完成"
- name: rebuild-dev
image: appleboy/drone-ssh
settings:
host: 120.79.247.16
username: root
password:
from_secret: prod_ssh_password
port: 22
command_timeout: 10m
script:
- echo "=== 重建测试环境 ==="
- cd /root/aiedu
- docker-compose -f docker-compose.dev.yml up -d --build
- sleep 5
- docker ps | grep kpl-
- echo "=== 测试环境部署完成: https://kpl.ireborn.com.cn ==="
---
kind: pipeline
type: docker
name: deploy-prod
# 生产环境main 分支触发,批量更新所有租户
trigger:
branch:
- main
event:
- push
steps:
- name: sync-code-to-server
image: appleboy/drone-ssh
settings:
host: 120.79.247.16
username: root
password:
from_secret: prod_ssh_password
port: 22
command_timeout: 10m
script:
- echo "=== 同步代码到生产服务器 ==="
- cd /root/aiedu
- git fetch origin
- git reset --hard origin/main
- echo "代码同步完成"
- name: build-frontend
image: appleboy/drone-ssh
settings:
host: 120.79.247.16
username: root
password:
from_secret: prod_ssh_password
port: 22
command_timeout: 10m
script:
- echo "=== 编译前端(所有租户共享)==="
- cd /root/aiedu/kaopeilian-frontend
- npm install --silent
- npm run build
- echo "前端编译完成,所有租户已更新"
- name: rebuild-backends
image: appleboy/drone-ssh
settings:
host: 120.79.247.16
username: root
password:
from_secret: prod_ssh_password
port: 22
command_timeout: 15m
script:
- echo "=== 重建所有后端服务 ==="
- cd /root/aiedu
- docker-compose -f docker-compose.prod-multi.yml up -d --build --no-deps hua-backend yy-backend hl-backend xy-backend fw-backend ex-backend cxw-backend
- sleep 10
- docker ps | grep backend
- echo "=== 生产环境批量更新完成 ==="
- echo "租户列表: hua, yy, hl, xy, fw, ex, cxw"
volumes:
- name: docker-sock
host:
path: /var/run/docker.sock
---
kind: pipeline
type: docker
name: code-check
trigger:
event:
- push
- pull_request
steps:
- name: python-lint
image: python:3.9-slim
commands:
- cd backend
- pip install flake8 -q
- flake8 app --count --select=E9,F63,F7,F82 --show-source --statistics || true
- echo "Python lint completed"
- name: frontend-check
image: node:18-alpine
commands:
- cd frontend
- echo "Frontend check completed"