1
1
name : Docker
2
2
3
3
on :
4
- schedule :
5
- - cron : " 0 17 * * 6"
4
+ # Disable schedule for preliminary testing
5
+ # schedule:
6
+ # - cron: "0 17 * * 6"
6
7
push :
7
8
branches :
8
9
- iron
18
19
PUSH : ${{ (github.event_name != 'pull_request') && (github.repository == 'Robotic-Decision-Making-Lab/blue') }}
19
20
20
21
jobs :
21
- ci :
22
+ docker_build :
22
23
strategy :
23
24
fail-fast : false
24
25
matrix :
28
29
packages : write
29
30
contents : read
30
31
steps :
31
- - name : Checkout repository
32
+ - name : Checkout
32
33
uses : actions/checkout@v4
33
34
35
+ <<<<<<< HEAD
34
36
- name : Log into registry
35
37
if : env.PUSH == 'true'
36
38
@@ -74,27 +76,45 @@ jobs:
74
76
75
77
- name : Set up QEMU
76
78
79
+ =======
80
+ - # Add support for more platforms with QEMU (optional)
81
+ # https://github.com/docker/setup-qemu-action
82
+ name : Set up QEMU
83
+ uses : docker/setup-qemu-action@v3
84
+ >>>>>>> a8681d0 (Add Docker BuildX config (#266))
77
85
78
86
- name : Set up Docker Buildx
79
87
uses : docker/setup-buildx-action@v3
80
88
81
- - name : Log into registry
82
- if : env.PUSH == 'true'
89
+ - if : env.PUSH == 'true'
90
+ name : Log into registry
83
91
84
92
with :
85
93
registry : ghcr.io
86
94
username : ${{ github.actor }}
87
95
password : ${{ secrets.GITHUB_TOKEN }}
88
96
89
- - name : Extract Docker metadata
97
+ # buildx bake, unfortunately, requires lower-cased repository names
98
+ # This shell ... er, hack, creates a local variable containing
99
+ # a down-cased version of $GITHUB_REPOSITORY
100
+ #
101
+ - id : lowercase-repo
102
+ name : Repository to lowercase
103
+ run : |
104
+ echo "repository=${GITHUB_REPOSITORY@L}" >> $GITHUB_OUTPUT
105
+
106
+ # Set metadata for each stage-image separately
107
+ - name : Set Docker metadata for "ci"
90
108
if : env.PUSH == 'true'
91
- id : meta
109
+ id : meta-ci
92
110
93
111
with :
94
112
images : ghcr.io/${{ github.repository }}
113
+ bake-target : docker-metadata-action-ci
95
114
tags : |
96
- type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }}
115
+ type=raw,value=${{ matrix.ROS_DISTRO }}-ci
97
116
117
+ <<<<<<< HEAD
98
118
- name : Build and push Docker image
99
119
100
120
with :
@@ -121,22 +141,19 @@ jobs:
121
141
uses : actions/checkout@v4
122
142
123
143
- name : Log into registry
144
+ =======
145
+ - name : Set Docker metadata for "robot"
146
+ >>>>>>> a8681d0 (Add Docker BuildX config (#266))
124
147
if : env.PUSH == 'true'
125
-
126
- with :
127
- registry : ghcr.io
128
- username : ${{ github.actor }}
129
- password : ${{ secrets.GITHUB_TOKEN }}
130
-
131
- - name : Extract Docker metadata
132
- if : env.PUSH == 'true'
133
- id : meta
148
+ id : meta-robot
134
149
135
150
with :
136
151
images : ghcr.io/${{ github.repository }}
152
+ bake-target : docker-metadata-action-robot
137
153
tags : |
138
- type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }}
154
+ type=raw,value=${{ matrix.ROS_DISTRO }}-robot
139
155
156
+ <<<<<<< HEAD
140
157
- name : Build and push Docker image
141
158
142
159
with :
@@ -162,29 +179,59 @@ jobs:
162
179
uses : actions/checkout@v4
163
180
164
181
- name : Log into registry
182
+ =======
183
+ - name : Set Docker metadata for "desktop"
184
+ >>>>>>> a8681d0 (Add Docker BuildX config (#266))
165
185
if : env.PUSH == 'true'
166
-
186
+ id : meta-desktop
187
+
167
188
with :
168
- registry : ghcr.io
169
- username : ${{ github.actor }}
170
- password : ${{ secrets.GITHUB_TOKEN }}
189
+ images : ghcr.io/${{ github.repository }}
190
+ bake-target : docker-metadata-action-desktop
191
+ tags : |
192
+ type=raw,value=${{ matrix.ROS_DISTRO }}-desktop
171
193
172
- - name : Extract Docker metadata
194
+ - name : Set Docker metadata for "desktop-nvidia"
173
195
if : env.PUSH == 'true'
174
- id : meta
196
+ id : meta-desktop-nvidia
175
197
176
198
with :
177
199
images : ghcr.io/${{ github.repository }}
200
+ bake-target : docker-metadata-action-desktop-nvidia
178
201
tags : |
179
- type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }}
180
-
181
- - name : Build and push Docker image
182
-
202
+ type=raw,value=${{ matrix.ROS_DISTRO }}-desktop-nvidia
203
+
204
+ - if : github.event_name == 'push'
205
+ name : Build and push (non PR)
206
+
207
+ env :
208
+ BLUE_ROS_DISTRO : ${{ matrix.ROS_DISTRO }}
209
+ BLUE_GITHUB_REPO : ${{ steps.lowercase-repo.outputs.repository }}
183
210
with :
184
- context : .
185
- file : .docker/Dockerfile
186
- build-args : ROS_DISTRO=${{ matrix.ROS_DISTRO }}
187
- target : ${{ github.job }}
188
- tags : ${{ steps.meta.outputs.tags }}
189
- labels : ${{ steps.meta.outputs.labels }}
211
+ workdir : .docker
212
+ files : |
213
+ ./docker-bake.hcl
214
+ ${{ steps.meta-ci.outputs.bake-file }}
215
+ ${{ steps.meta-robot.outputs.bake-file }}
216
+ ${{ steps.meta-desktop.outputs.bake-file }}
217
+ ${{ steps.meta-desktop-nvidia.outputs.bake-file }}
190
218
push : ${{ env.PUSH }}
219
+ set : |
220
+ *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}:cache-${{ matrix.ROS_DISTRO }}
221
+ *.cache-to=type=registry,mode=max,ref=ghcr.io/${{ github.repository }}:cache-${{ matrix.ROS_DISTRO }}
222
+
223
+ # Pull request builds are not cached; and only built for AMD64
224
+ - if : github.event_name == 'pull_request'
225
+ name : Build and push (PR)
226
+
227
+ env :
228
+ BLUE_ROS_DISTRO : ${{ matrix.ROS_DISTRO }}
229
+ BLUE_GITHUB_REPO : ${{ steps.lowercase-repo.outputs.repository }}
230
+ with :
231
+ workdir : .docker
232
+ files : |
233
+ ./docker-bake.hcl
234
+ set : |
235
+ *.platform=linux/amd64
236
+ *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}:cache-${{ matrix.ROS_DISTRO }}
237
+ *.cache-to=
0 commit comments