-
Notifications
You must be signed in to change notification settings - Fork 12
156 lines (138 loc) · 5.91 KB
/
release_base_image.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Release DongTai IAST Base Image
on:
release:
types: [ created, edited ]
jobs:
Release-DongTai-Infra-Service:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
steps:
- name: start-build
uses: joelwmale/webhook-action@master
with:
url: ${{ secrets.WEBHOOK_URL }}
body: '{"msg_type": "interactive","card": {"config": {"wide_screen_mode": true,"enable_forward": true},"elements": [{"tag": "div","text": {"content": "状态:构建开始\n项目:${{github.repository}}\n分支:${{github.ref}}\n流程:${{github.workflow}}\n构建编号:${{github.run_number}}\n触发事件:${{github.event_name}}\n提交人:${{github.actor}}\nSHA-1:${{github.sha}}\n","tag": "lark_md"}}]}}'
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DONGTAI_DOCKERHUB_USERNAME }}
password: ${{ secrets.DONGTAI_DOCKERHUB_TOKEN }}
- name: Login to AliyunRegistry
uses: docker/login-action@v1
with:
registry: ${{ secrets.ALIYUN_REGISTRY }}
username: ${{ secrets.ALIYUN_DOCKERHUB_USER }}
password: ${{ secrets.ALIYUN_DOCKERHUB_PASSWORD }}
- id: release
run: |
TAG_NAME=${{ github.event.release.tag_name }}
ID=`echo ${TAG_NAME##v}`
echo "::set-output name=version::$ID"
- name: Build and push logstash
uses: docker/build-push-action@v3
with:
context: ./logstash
file: ./logstash/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
dongtai/dongtai-logstash:${{ steps.release.outputs.version }}
dongtai/dongtai-logstash:latest
- name: Build and push logrotate
uses: docker/build-push-action@v3
with:
context: ./logrotate
file: ./logrotate/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
dongtai/dongtai-logrotate:${{ steps.release.outputs.version }}
dongtai/dongtai-logrotate:latest
- name: Build and push Redis
uses: docker/build-push-action@v2
with:
context: ./redis
push: true
platforms: linux/amd64,linux/arm64
tags: |
dongtai/dongtai-redis:${{ steps.release.outputs.version }}
dongtai/dongtai-redis:latest
- name: finish build
uses: joelwmale/webhook-action@master
with:
url: ${{ secrets.WEBHOOK_URL }}
body: '{"msg_type": "interactive","card": {"config": {"wide_screen_mode": true,"enable_forward": true},"elements": [{"tag": "div","text": {"content": "状态:构建完成\n项目:${{github.repository}}\n分支:${{github.ref}}\n流程:${{github.workflow}}\n构建编号:${{github.run_number}}\n触发事件:${{github.event_name}}\n提交人:${{github.actor}}\nSHA-1:${{github.sha}}\n","tag": "lark_md"}}]}}'
dongtai-mysql:
name: dongtai-mysql
# needs:
# - Release-DongTai-Infra-Service
runs-on: ubuntu-latest
services:
dongtai-mysql:
image: dongtai/dongtai-mysql:latest
ports:
- 3306:3306
dongtai-redis:
image: dongtai/dongtai-redis:latest
ports:
- 6379:6379
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DONGTAI_DOCKERHUB_USERNAME }}
password: ${{ secrets.DONGTAI_DOCKERHUB_TOKEN }}
- name: Login to AliyunRegistry
uses: docker/login-action@v2
with:
registry: ${{ secrets.ALIYUN_REGISTRY }}
username: ${{ secrets.ALIYUN_DOCKERHUB_USER }}
password: ${{ secrets.ALIYUN_DOCKERHUB_PASSWORD }}
- id: release
run: |
TAG_NAME=${{ github.event.release.tag_name }}
ID=`echo ${TAG_NAME##v}`
echo "::set-output name=version::$ID"
- name: Build Mysql only schema to local
working-directory: ./mysql
run: |
docker pull wukong.tencentcloudcr.com/dongtai/dongtai-server:${{ steps.release.outputs.version }}
docker run -i --name dongtai-server-update -v $(pwd)/config-tutorial.ini:/opt/dongtai/dongtai_conf/conf/config.ini --rm --link `docker ps | grep dongtai-mysql | awk '{print $1}'`:dongtai-mysql \
--link `docker ps | grep dongtai-redis | awk '{print $1}'`:dongtai-redis \
--network ${{ job.container.network }} wukong.tencentcloudcr.com/dongtai/dongtai-server:${{ steps.release.outputs.version }} migrate || exit 1
docker exec -i `docker ps | grep dongtai-mysql | awk '{print $1}'` /bin/bash -c "mysqldump dongtai_webapi -u root -p'dongtai-iast' --single-transaction" > dongtai-mysql-schema.sql || exit 1
- name: Build Mysql only schema to local
uses: docker/build-push-action@v3
with:
context: ./mysql
push: true
# platforms: linux/amd64,linux/arm64
tags: |
dongtai/dongtai-mysql:${{ steps.release.outputs.version }}
# dongtai/dongtai-mysql:latest
- name: Install Mysql 8.0
working-directory: ./mysql
run: |
sed -i 's#5.7#8.0#g' Dockerfile
- name: Build Mysql 8.0
uses: docker/build-push-action@v3
with:
context: ./mysql
push: true
platforms: linux/amd64,linux/arm64
tags: |
dongtai/dongtai-mysql-8:${{ steps.release.outputs.version }}
# dongtai/dongtai-mysql-8:latest