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