-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (44 loc) · 1.85 KB
/
docker-image-uat.yml
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
name: Docker Image CI/CD
on:
push:
paths-ignore: # 忽略一些不必要的文件
- ".gitignore"
- "README.md"
- ".vscode/**"
branches: [ "master" ]
#tags: # 当我们提交代码为tag 是以'v'开头的时候才会触发自动部署到服务端
# - 'v*'
jobs:
docker-image-build-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '11'
cache: 'maven'
cache-dependency-path: 'pom.xml' # optional
- uses: docker/login-action@v1
with:
registry: ghcr.io # 声明镜像源
username: ${{ github.actor }}
password: ${{ secrets.HUB_GITHUB_ACCESS_TOKEN }}
- uses: docker/login-action@v1
with:
registry: ${{ secrets.TC_DOCKER_HUB_ADDRESS }} # 声明镜像源
username: ${{ secrets.TC_DOCKER_HUB_USERNAME }}
password: ${{ secrets.TC_DOCKER_HUB_PASSWORD }}
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Build docker image
run:
docker buildx build --file Dockerfile --tag rulateday-api-server-uat:latest .
- name: create ghcr tag
run: docker image tag rulateday-api-server-uat:latest ghcr.io/rulateday/rulateday-api-server-uat:latest
- name: ghcr.io push image
run: docker push ghcr.io/rulateday/rulateday-api-server-uat:latest
- name: create tencent docker hub tag
run: docker image tag rulateday-api-server-uat:latest ${{ secrets.TC_DOCKER_HUB_ADDRESS }}/rulateday/rulateday-api-server-uat:latest
- name: tencent push image
run: docker push ${{ secrets.TC_DOCKER_HUB_ADDRESS }}/rulateday/rulateday-api-server-uat:latest