vending-machine/.drone.yml
zpc c48f4110c2
All checks were successful
continuous-integration/drone/push Build is passing
21
2026-04-12 00:56:30 +08:00

64 lines
1.5 KiB
YAML

---
kind: pipeline
type: docker
name: vending-machine
trigger:
branch:
- main
event:
- push
steps:
# ==================== 构建后端 API 镜像 ====================
- name: build-api
image: plugins/docker
settings:
registry: 192.168.195.25:19900
repo: 192.168.195.25:19900/vending-machine/api
dockerfile: backend/src/VendingMachine.Api/Dockerfile
context: backend
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
username:
from_secret: harbor_username
password:
from_secret: harbor_password
insecure: true
# ==================== 构建前端 Admin 镜像 ====================
- name: build-admin
image: plugins/docker
settings:
registry: 192.168.195.25:19900
repo: 192.168.195.25:19900/vending-machine/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/vending-machine
- docker compose pull
- docker compose up -d
depends_on:
- build-api
- build-admin