-
Notifications
You must be signed in to change notification settings - Fork 2
/
.drone.yaml
78 lines (73 loc) · 2.19 KB
/
.drone.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
kind: pipeline
name: cicd
type: docker
clone:
disable: true
trigger:
ref:
- refs/tags/v*
steps: # 定义流水线执行步骤,这些步骤将顺序执行
- name: clone
image: alpine/git
pull: if-not-exists
environment:
http_proxy:
from_secret: PROXY
https_proxy:
from_secret: PROXY
commands:
- git config --global core.compression 0
- git clone https://github.com/dataelement/bisheng-ft.git .
- git checkout $DRONE_COMMIT
- name: show_yaml_content
image: alpine/git
pull: if-not-exists
commands:
- cat .drone.yaml
- name: build_docker
pull: if-not-exists
image: docker:24.0.6
environment:
http_proxy:
from_secret: PROXY
https_proxy:
from_secret: PROXY
no_proxy: 192.168.106.8,192.168.106.8
version: ${DRONE_TAG}
docker_repo: dataelement/bisheng-ft
docker_user:
from_secret: DOCKER_USER
docker_password:
from_secret: DOCKER_PASSWORD
cr_user:
from_secret: CR_USER
cr_password:
from_secret: CR_PASSWORD
cr_repo_host: cr.dataelem.com
privileged: true
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
- name: apt-cache
path: /var/cache/apt/archives # 将应用打包好的Jar和执行脚本挂载出来
- name: socket
path: /var/run/docker.sock
commands:
- docker login -u $cr_user -p $cr_password $cr_repo_host
- docker login -u $docker_user -p $docker_password
- docker build -t $docker_repo:$version -f ./docker/bisheng_ft.Dockerfile ./
- docker push $docker_repo:$version
- docker tag $docker_repo:$version $cr_repo_host/$docker_repo:$version
- docker tag $docker_repo:$version $docker_repo:latest
- docker tag $docker_repo:$version $cr_repo_host/$docker_repo:latest
- docker push $docker_repo:latest
- docker push $cr_repo_host/$docker_repo:$version
- docker push $cr_repo_host/$docker_repo:latest
volumes:
- name: bisheng-cache
host:
path: /opt/drone/data/bisheng/
- name: apt-cache
host:
path: /opt/drone/data/bisheng/apt/
- name: socket
host:
path: /var/run/docker.sock