@@ -99,6 +99,26 @@ build_buildx() {
99
99
)
100
100
}
101
101
102
+ build_compose () {
103
+ [ -d " ${COMPOSE_DIR:? } /bin" ] && rm -r " ${COMPOSE_DIR:? } /bin"
104
+ (
105
+ cd " ${COMPOSE_DIR} "
106
+ set -x
107
+ # TODO: Add TARGETPLATFORM support on compose repo to build efficiently with buildx
108
+ make GIT_TAG=" ${DOCKER_COMPOSE_REF} " cross
109
+ )
110
+ }
111
+
112
+ build_scan () {
113
+ [ -d " ${SCAN_DIR:? } /bin" ] && rm -r " ${SCAN_DIR:? } /bin"
114
+ (
115
+ cd " ${SCAN_DIR} "
116
+ set -x
117
+ # TODO: Add TARGETPLATFORM support on scan-cli-plugin repo to build efficiently with --platform
118
+ make GIT_TAG_NAME=" ${DOCKER_SCAN_REF} " cross
119
+ )
120
+ }
121
+
102
122
CROSS=true
103
123
if [ " $TARGETOS " = " linux" ] && [ " $CURARCH$CURVARIANT " = " $TARGETARCH$TARGETVARIANT " ]; then
104
124
CROSS=false
@@ -124,6 +144,8 @@ buildDir="${CURDIR}/build/${TARGETPLATFORM}"
124
144
dockerBuildDir=" ${buildDir} /docker"
125
145
rootlessExtrasBuildDir=" ${buildDir} /docker-rootless-extras"
126
146
buildxBuildDir=" ${buildDir} /docker-buildx"
147
+ composeBuildDir=" ${buildDir} /docker-compose"
148
+ scanBuildDir=" ${buildDir} /docker-scan"
127
149
128
150
# create docker-container builder
129
151
docker buildx inspect | grep -q ' Driver: docker-container' || docker buildx create --use
@@ -137,15 +159,27 @@ case ${TARGETOS} in
137
159
build_engine_cross
138
160
fi
139
161
build_buildx
162
+ build_compose
163
+ # TODO change once we support scan-plugin on other architectures
164
+ if [ " ${TARGETARCH} " = " amd64" ]; then
165
+ build_scan
166
+ fi
140
167
;;
141
168
darwin)
142
169
build_cli
143
170
build_buildx
171
+ build_compose
172
+ build_scan
144
173
;;
145
174
windows)
146
175
build_cli
147
176
build_engine_cross
148
177
build_buildx
178
+ build_compose
179
+ # TODO change once we support scan-plugin on other architectures
180
+ if [ " ${TARGETARCH} " = " amd64" ]; then
181
+ build_scan
182
+ fi
149
183
;;
150
184
esac
151
185
@@ -216,31 +250,106 @@ if [ -d "${rootlessExtrasBuildDir}" ]; then
216
250
fi
217
251
218
252
# buildx
219
- mkdir -p " ${buildxBuildDir} "
220
- case ${TARGETOS} in
221
- linux | darwin)
222
- cp " ${BUILDX_DIR} /bin/${targetPair} /buildx" " ${buildxBuildDir} /docker-buildx"
223
- ;;
224
- windows)
225
- cp " ${BUILDX_DIR} /bin/${targetPair} /buildx.exe" " ${buildxBuildDir} /docker-buildx.exe"
226
- ;;
227
- esac
228
- # package buildx
229
- case ${TARGETOS} in
230
- linux | darwin)
231
- (
232
- set -x
233
- tar -C " ${buildDir} " -c -z -f " ${buildDir} /docker-buildx-plugin-${DOCKER_BUILDX_REF# v} .tgz" docker-buildx
234
- )
235
- ;;
236
- windows)
237
- (
238
- cd " ${buildDir} "
239
- set -x
240
- zip -r " docker-buildx-plugin-${DOCKER_BUILDX_REF# v} .zip" docker-buildx
241
- )
242
- ;;
243
- esac
253
+ if [ -d " ${BUILDX_DIR} /bin" ]; then
254
+ mkdir -p " ${buildxBuildDir} "
255
+ case ${TARGETOS} in
256
+ linux | darwin)
257
+ cp " ${BUILDX_DIR} /bin/${targetPair} /buildx" " ${buildxBuildDir} /docker-buildx"
258
+ ;;
259
+ windows)
260
+ cp " ${BUILDX_DIR} /bin/${targetPair} /buildx.exe" " ${buildxBuildDir} /docker-buildx.exe"
261
+ ;;
262
+ esac
263
+ # package buildx
264
+ case ${TARGETOS} in
265
+ linux | darwin)
266
+ (
267
+ set -x
268
+ tar -C " ${buildDir} " -c -z -f " ${buildDir} /docker-buildx-plugin-${DOCKER_BUILDX_REF# v} .tgz" docker-buildx
269
+ )
270
+ ;;
271
+ windows)
272
+ (
273
+ cd " ${buildDir} "
274
+ set -x
275
+ zip -r " docker-buildx-plugin-${DOCKER_BUILDX_REF# v} .zip" docker-buildx
276
+ )
277
+ ;;
278
+ esac
279
+ fi
280
+
281
+ # compose
282
+ if [ -d " ${COMPOSE_DIR} /bin" ]; then
283
+ mkdir -p " ${composeBuildDir} "
284
+ composeTargetPair=" ${TARGETOS} "
285
+ case ${TARGETARCH} in
286
+ amd64)
287
+ composeTargetPair=" ${composeTargetPair} -x86_64"
288
+ ;;
289
+ arm64)
290
+ composeTargetPair=" ${composeTargetPair} -aarch64"
291
+ ;;
292
+ * )
293
+ composeTargetPair=" ${composeTargetPair} -${TARGETARCH} "
294
+ ;;
295
+ esac
296
+ if [ -n " $TARGETVARIANT " ]; then
297
+ composeTargetPair=" ${composeTargetPair}${TARGETVARIANT} "
298
+ fi
299
+ case ${TARGETOS} in
300
+ linux | darwin)
301
+ cp " ${COMPOSE_DIR} /bin/docker-compose-${composeTargetPair} " " ${composeBuildDir} /docker-compose"
302
+ ;;
303
+ windows)
304
+ cp " ${COMPOSE_DIR} /bin/docker-compose-${composeTargetPair} .exe" " ${composeBuildDir} /docker-compose.exe"
305
+ ;;
306
+ esac
307
+ # package compose
308
+ case ${TARGETOS} in
309
+ linux | darwin)
310
+ (
311
+ set -x
312
+ tar -C " ${buildDir} " -c -z -f " ${buildDir} /docker-compose-plugin-${DOCKER_COMPOSE_REF# v} .tgz" docker-compose
313
+ )
314
+ ;;
315
+ windows)
316
+ (
317
+ cd " ${buildDir} "
318
+ set -x
319
+ zip -r " docker-compose-plugin-${DOCKER_COMPOSE_REF# v} .zip" docker-compose
320
+ )
321
+ ;;
322
+ esac
323
+ fi
324
+
325
+ # scan
326
+ if [ -d " ${SCAN_DIR} /dist" ]; then
327
+ mkdir -p " ${scanBuildDir} "
328
+ case ${TARGETOS} in
329
+ linux | darwin)
330
+ cp " ${SCAN_DIR} /dist/docker-scan_${TARGETOS} _${TARGETARCH} " " ${scanBuildDir} /docker-scan"
331
+ ;;
332
+ windows)
333
+ cp " ${SCAN_DIR} /dist/docker-scan_${TARGETOS} _${TARGETARCH} .exe" " ${scanBuildDir} /docker-scan.exe"
334
+ ;;
335
+ esac
336
+ # package compose
337
+ case ${TARGETOS} in
338
+ linux | darwin)
339
+ (
340
+ set -x
341
+ tar -C " ${buildDir} " -c -z -f " ${buildDir} /docker-scan-plugin-${DOCKER_SCAN_REF# v} .tgz" docker-scan
342
+ )
343
+ ;;
344
+ windows)
345
+ (
346
+ cd " ${buildDir} "
347
+ set -x
348
+ zip -r " docker-scan-plugin-${DOCKER_SCAN_REF# v} .zip" docker-scan
349
+ )
350
+ ;;
351
+ esac
352
+ fi
244
353
245
354
# create bundle
246
355
(
0 commit comments