-
Notifications
You must be signed in to change notification settings - Fork 14
235 lines (211 loc) · 8.26 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
---
name: Build, test and push Docker Images
on:
pull_request:
paths:
- ".github/workflows/docker.yml"
# We use local reusable workflows to make architecture clean an simple
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
- ".github/workflows/docker-build-test-upload.yml"
- ".github/workflows/docker-merge-tags.yml"
- ".github/workflows/docker-push.yml"
# We use local composite actions to combine multiple workflow steps within one action
# https://docs.github.com/en/actions/creating-actions/about-custom-actions#composite-actions
- ".github/actions/create-dev-env/action.yml"
- ".github/actions/load-image/action.yml"
- "stack/base/**"
- "stack/base-with-services/**"
- "stack/lab/**"
- "stack/full-stack/**"
- "build.json"
- "docker-bake.hcl"
- "tests/**"
- "requirements-dev.txt"
push:
branches:
- main
tags:
- "v*"
paths:
- ".github/workflows/docker.yml"
# We use local reusable workflows to make architecture clean an simple
# https://docs.github.com/en/actions/using-workflows/reusing-workflows
- ".github/workflows/docker-build-test-upload.yml"
- ".github/workflows/docker-merge-tags.yml"
- ".github/workflows/docker-push.yml"
# We use local composite actions to combine multiple workflow steps within one action
# https://docs.github.com/en/actions/creating-actions/about-custom-actions#composite-actions
- ".github/actions/create-dev-env/action.yml"
- ".github/actions/load-image/action.yml"
- "stack/base/**"
- "stack/base-with-services/**"
- "stack/lab/**"
- "stack/full-stack/**"
- "build.json"
- "docker-bake.hcl"
- "tests/**"
- "requirements-dev.txt"
workflow_dispatch:
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
amd64-base:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: base
architecture: amd64
runsOn: ubuntu-latest
amd64-base-with-services:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: base-with-services
architecture: amd64
runsOn: ubuntu-latest
needs: [amd64-base]
amd64-lab:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: lab
architecture: amd64
runsOn: ubuntu-latest
needs: [amd64-base]
amd64-full-stack:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: full-stack
architecture: amd64
runsOn: ubuntu-latest
needs: [amd64-base-with-services, amd64-lab]
amd64-qe:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: qe
architecture: amd64
runsOn: ubuntu-latest
needs: [amd64-full-stack]
arm64-base:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: base
architecture: arm64
runsOn: ARM64
arm64-lab:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: lab
architecture: arm64
runsOn: ARM64
needs: [arm64-base]
arm64-base-with-services:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: base-with-services
architecture: arm64
runsOn: ARM64
needs: [arm64-base]
arm64-full-stack:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: full-stack
architecture: arm64
runsOn: ARM64
needs: [arm64-base-with-services, arm64-lab]
arm64-qe:
uses: ./.github/workflows/docker-build-test-upload.yml
with:
image: qe
architecture: arm64
runsOn: ARM64
needs: [arm64-full-stack]
amd64-push-ghcr:
uses: ./.github/workflows/docker-push.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack", "qe"]
with:
architecture: amd64
image: ${{ matrix.image }}
registry: ghcr.io
secrets:
REGISTRY_USERNAME: ${{ github.actor }}
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
needs: [amd64-base, amd64-base-with-services, amd64-lab, amd64-full-stack, amd64-qe]
arm64-push-ghcr:
uses: ./.github/workflows/docker-push.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack", "qe"]
with:
architecture: arm64
image: ${{ matrix.image }}
registry: ghcr.io
secrets:
REGISTRY_USERNAME: ${{ github.actor }}
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
needs: [arm64-base, arm64-base-with-services, arm64-lab, arm64-full-stack, arm64-qe]
merge-tags-ghcr:
uses: ./.github/workflows/docker-merge-tags.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack", "qe"]
with:
image: ${{ matrix.image }}
registry: ghcr.io
secrets:
REGISTRY_USERNAME: ${{ github.actor }}
REGISTRY_TOKEN: ${{ secrets.GITHUB_TOKEN }}
needs: [amd64-push-ghcr, arm64-push-ghcr]
amd64-push-dockerhub:
if: github.repository == 'aiidalab/aiidalab-docker-stack' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: ./.github/workflows/docker-push.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack", "qe"]
with:
architecture: amd64
image: ${{ matrix.image }}
registry: docker.io
secrets:
REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
needs: [amd64-base, amd64-base-with-services, amd64-lab, amd64-full-stack, amd64-qe]
arm64-push-dockerhub:
if: github.repository == 'aiidalab/aiidalab-docker-stack' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: ./.github/workflows/docker-push.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack", "qe"]
with:
architecture: arm64
image: ${{ matrix.image }}
registry: docker.io
secrets:
REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
needs: [arm64-base, arm64-base-with-services, arm64-lab, arm64-full-stack, arm64-qe]
merge-tags-dockerhub:
if: github.repository == 'aiidalab/aiidalab-docker-stack' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
uses: ./.github/workflows/docker-merge-tags.yml
strategy:
matrix:
image: ["base", "base-with-services", "lab", "full-stack", "qe"]
with:
image: ${{ matrix.image }}
registry: docker.io
secrets:
REGISTRY_USERNAME: ${{ secrets.DOCKER_USERNAME }}
REGISTRY_TOKEN: ${{ secrets.DOCKER_PASSWORD }}
needs: [amd64-push-dockerhub, arm64-push-dockerhub]
release:
runs-on: ubuntu-latest
needs: [merge-tags-ghcr, merge-tags-dockerhub]
steps:
- uses: actions/checkout@v3
- name: Create release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
if: github.repository == 'aiidalab/aiidalab-docker-stack' && startsWith(github.ref, 'refs/tags/v')