chore: 参照后端配置,使用 kaniko 构建,添加 k8s 部署文件
This commit is contained in:
72
.drone.yml
72
.drone.yml
@@ -1,9 +1,10 @@
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
name: build-and-deploy-dev
|
||||
|
||||
service_account_name: drone-builder-sa
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
@@ -11,50 +12,41 @@ trigger:
|
||||
- dev
|
||||
|
||||
steps:
|
||||
- name: dev-clone
|
||||
image: ccr.ccs.tencentyun.com/violin/git-alpine:latest
|
||||
settings:
|
||||
username:
|
||||
from_secret: git_username
|
||||
password:
|
||||
from_secret: git_password
|
||||
|
||||
- name: dev-install
|
||||
image: node:18-alpine
|
||||
image: ccr.ccs.tencentyun.com/violin/node:18-alpine
|
||||
commands:
|
||||
- npm install
|
||||
|
||||
- name: dev-build
|
||||
image: node:18-alpine
|
||||
image: ccr.ccs.tencentyun.com/violin/node:18-alpine
|
||||
commands:
|
||||
- npm run build:h5
|
||||
|
||||
- name: dev-build-image
|
||||
image: ccr.ccs.tencentyun.com/violin/docker:linux-amd64
|
||||
image: ccr.ccs.tencentyun.com/violin/drone-kaniko:latest
|
||||
settings:
|
||||
repo: ccr.ccs.tencentyun.com/violin/todo-frontend
|
||||
tags:
|
||||
- ${DRONE_COMMIT_SHA}
|
||||
- latest
|
||||
username:
|
||||
from_secret: registry_username
|
||||
- ${DRONE_COMMIT_SHA:0:8}
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
registry: ccr.ccs.tencentyun.com
|
||||
username: 100024540033
|
||||
password:
|
||||
from_secret: registry_password
|
||||
from_secret: docker_password
|
||||
|
||||
- name: dev-deploy
|
||||
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
|
||||
cluster: kubernetes
|
||||
namespace: drone
|
||||
commands:
|
||||
- kubectl set image deployment/todo-frontend todo-frontend=ccr.ccs.tencentyun.com/violin/todo-frontend:${DRONE_COMMIT_SHA} -n drone
|
||||
- kubectl rollout status deployment/todo-frontend -n drone
|
||||
environment:
|
||||
KUBECONFIG:
|
||||
from_secret: kubeconfig
|
||||
- kubectl apply -f k8s/deployment.yaml
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
clone:
|
||||
disable: true
|
||||
|
||||
name: build-and-deploy-prod
|
||||
|
||||
trigger:
|
||||
@@ -64,41 +56,33 @@ trigger:
|
||||
- master
|
||||
|
||||
steps:
|
||||
- name: prod-clone
|
||||
image: ccr.ccs.tencentyun.com/violin/git-alpine:latest
|
||||
settings:
|
||||
username:
|
||||
from_secret: git_username
|
||||
password:
|
||||
from_secret: git_password
|
||||
|
||||
- name: prod-install
|
||||
image: node:18-alpine
|
||||
image: ccr.ccs.tencentyun.com/violin/node:18-alpine
|
||||
commands:
|
||||
- npm install
|
||||
|
||||
- name: prod-build
|
||||
image: node:18-alpine
|
||||
image: ccr.ccs.tencentyun.com/violin/node:18-alpine
|
||||
commands:
|
||||
- npm run build:h5
|
||||
|
||||
- name: prod-build-image
|
||||
image: ccr.ccs.tencentyun.com/violin/docker:linux-amd64
|
||||
image: ccr.ccs.tencentyun.com/violin/drone-kaniko:latest
|
||||
settings:
|
||||
repo: ccr.ccs.tencentyun.com/violin/todo-frontend
|
||||
tags:
|
||||
- ${DRONE_COMMIT_SHA}
|
||||
- v1.0.0
|
||||
username:
|
||||
from_secret: registry_username
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
registry: ccr.ccs.tencentyun.com
|
||||
username: 100024540033
|
||||
password:
|
||||
from_secret: registry_password
|
||||
from_secret: docker_password
|
||||
|
||||
- name: prod-deploy
|
||||
image: ccr.ccs.tencentyun.com/violin/kubectl:latest
|
||||
cluster: kubernetes
|
||||
namespace: drone
|
||||
commands:
|
||||
- kubectl set image deployment/todo-frontend todo-frontend=ccr.ccs.tencentyun.com/violin/todo-frontend:${DRONE_COMMIT_SHA} -n drone
|
||||
- kubectl rollout status deployment/todo-frontend -n drone
|
||||
environment:
|
||||
KUBECONFIG:
|
||||
from_secret: kubeconfig
|
||||
- kubectl set image deployment/todo-frontend todo-frontend=ccr.ccs.tencentyun.com/violin/todo-frontend:v1.0.0
|
||||
- kubectl rollout status deployment/todo-frontend
|
||||
|
||||
Reference in New Issue
Block a user