campus-errand/.drone.yml

64 lines
1.5 KiB
YAML

---
kind: pipeline
type: docker
name: campus-errand
trigger:
branch:
- main
event:
- push
steps:
# ==================== 构建后端 API 镜像 ====================
- name: build-server
image: plugins/docker
settings:
registry: 192.168.195.25:19900
repo: 192.168.195.25:19900/campus-errand/server
dockerfile: server/Dockerfile
context: server
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
username:
from_secret: harbor_username
password:
from_secret: harbor_password
insecure: true
# ==================== 构建后台管理前端镜像 ====================
- name: build-admin
image: plugins/docker
settings:
registry: 192.168.195.25:19900
repo: 192.168.195.25:19900/campus-errand/admin
dockerfile: admin/Dockerfile
context: admin
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
username:
from_secret: harbor_username
password:
from_secret: harbor_password
insecure: true
# ==================== 部署到服务器 ====================
- name: deploy
image: appleboy/drone-ssh
settings:
host: 192.168.195.15
username:
from_secret: ssh_username
password:
from_secret: ssh_password
port: 22
script:
- cd /disk/docker-compose/campus-errand
- docker compose pull
- docker compose up -d
depends_on:
- build-server
- build-admin