-
Notifications
You must be signed in to change notification settings - Fork 1
164 lines (151 loc) · 4.24 KB
/
docker.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
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
157
158
159
160
161
162
163
164
name: Build and Push Docker Image
on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*'
paths:
- '.github/actions/build-and-push-docker/action.yml'
- '.github/workflows/docker.yml'
- 'docker-bake.hcl'
- 'cann/**'
- 'pytorch/**'
- 'mindspore/**'
- '!**/*.md'
pull_request:
branches:
- 'main'
paths:
- '.github/actions/build-and-push-docker/action.yml'
- '.github/workflows/docker.yml'
- 'docker-bake.hcl'
- 'cann/**'
- 'pytorch/**'
- 'mindspore/**'
- '!**/*.md'
release:
types:
- 'published'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'release/')}}
env:
registries: |
[
{
"url": "docker.io",
"owner": "${{ secrets.DOCKERHUB_OWNER }}"
},
{
"url": "ghcr.io",
"owner": "${{ github.repository_owner }}"
},
{
"url": "quay.io",
"owner": "${{ secrets.QUAY_OWNER }}"
}
]
jobs:
prepare:
name: prepare
runs-on: ubuntu-latest
outputs:
cann-targets: ${{ steps.list-cann-target.outputs.targets }}
pth-targets: ${{ steps.list-pth-target.outputs.targets }}
ms-targets: ${{ steps.list-ms-target.outputs.targets }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: List cann targets
id: list-cann-target
uses: docker/bake-action/subaction/list-targets@v4
with:
target: cann
- name: List pytorch targets
id: list-pth-target
uses: docker/bake-action/subaction/list-targets@v4
with:
target: pytorch
- name: List mindspore targets
id: list-ms-target
uses: docker/bake-action/subaction/list-targets@v4
with:
target: mindspore
cann:
name: cann
runs-on: ubuntu-latest
permissions:
packages: write
needs:
- prepare
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.cann-targets) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push Docker
uses: ./.github/actions/build-and-push-docker
with:
target: ${{ matrix.target }}
dockerhub_owner: ${{ secrets.DOCKERHUB_OWNER }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
quay_owner: ${{ secrets.QUAY_OWNER }}
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_token: ${{ secrets.QUAY_TOKEN }}
pytorch:
name: pytorch
runs-on: ubuntu-latest
if: ${{ success() || failure() }}
permissions:
packages: write
needs:
- prepare
- cann
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.pth-targets) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push Docker
uses: ./.github/actions/build-and-push-docker
with:
target: ${{ matrix.target }}
dockerhub_owner: ${{ secrets.DOCKERHUB_OWNER }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
quay_owner: ${{ secrets.QUAY_OWNER }}
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_token: ${{ secrets.QUAY_TOKEN }}
mindspore:
name: mindspore
runs-on: ubuntu-latest
if: ${{ success() || failure() }}
permissions:
packages: write
needs:
- prepare
- cann
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.ms-targets) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and push Docker
uses: ./.github/actions/build-and-push-docker
with:
target: ${{ matrix.target }}
dockerhub_owner: ${{ secrets.DOCKERHUB_OWNER }}
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
quay_owner: ${{ secrets.QUAY_OWNER }}
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_token: ${{ secrets.QUAY_TOKEN }}