-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
734 lines (672 loc) · 25.3 KB
/
docker-bake.hcl
File metadata and controls
734 lines (672 loc) · 25.3 KB
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
// Copyright 2022 Docker Packaging authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
variable "DISTROS" {
description = "List of supported distros. Don't forget to update _distro-* target if you add/remove a distro."
default = [
"static",
"debian11",
"debian12",
"debian13",
"ubuntu2204",
"ubuntu2404",
"ubuntu2510",
"ubuntu2604",
"almalinux8",
"almalinux9",
"centos9",
"centos10",
"fedora42",
"fedora43",
"fedora44",
"oraclelinux8",
"oraclelinux9",
"rhel8",
"rhel9",
"rhel10",
"rockylinux8",
"rockylinux9"
]
}
variable "PKGS" {
description = "List of packages to build from ./pkg directory. Don't forget to update _pkg-* target if you add/remove a package."
default = [
"buildx",
"compose",
"containerd",
"credential-helpers",
"docker-cli",
"docker-engine",
"model",
"agent"
]
}
variable "DISTRO_NAME" {
description = "Name of the distro."
default = null
}
variable "DISTRO_TYPE" {
description = "Type of the distro. One of deb, rpm, static."
default = null
}
variable "DISTRO_RELEASE" {
description = "Distro release name."
default = null
}
variable "DISTRO_ID" {
description = "Distro ID, e.g. 11 for debian11, 12 for debian12, etc."
default = null
}
variable "DISTRO_SUITE" {
description = "Distro suite name, e.g. bullseye for debian11, bookworm for debian12, etc."
default = null
}
variable "DISTRO_IMAGE" {
description = "Distro image to use for building packages."
default = null
}
variable "PKG_NAME" {
description = "Name of the package to build."
default = null
}
variable "PKG_REPO" {
description = "Repository URL of the package to build."
default = null
}
variable "PKG_REF" {
description = "Reference (branch, tag, commit) of the package to build."
default = null
}
variable "PKG_VENDOR" {
description = "Name of the vendor/maintainer of the package (only for linux packages)."
default = "Docker"
}
variable "PKG_PACKAGER" {
description = "Name of the company that produced the package (only for linux packages)."
default = "Docker <support@docker.com>"
}
variable "PKG_DEB_BUILDFLAGS" {
description = "Flags to pass to dpkg-buildpackage."
default = "-b -uc"
}
variable "PKG_DEB_REVISION" {
description = "Revision of the package to build, used for debian packages. Include an extra .0 in the version, in case we ever would have to re-build an already published release with a packaging-only change."
default = "1"
}
variable "PKG_DEB_EPOCH" {
description = "Epoch of the package to build, used for debian packages. This is used to allow mistakes in the version numbers of older versions of a package, and also a package's previous version numbering schemes, to be left behind. Should be enforced per package and not globally."
default = null
}
variable "PKG_RPM_BUILDFLAGS" {
description = "Flags to pass to rpmbuild."
default = "-bb"
}
# rpm "Release:" field ($rpmRelease) is used to set the "_release" macro, which
# is an incremental number for builds of the same release (Version: / #rpmVersion)
# - Version: 0 : Package was built, but no matching upstream release (e.g., can be used for "nightly" builds)
# - Version: 1 : Package was built for an upstream (pre)release version
# - Version: > 1 : Only to be used for packaging-only changes (new package built for a version for which a package was already built/released)
variable "PKG_RPM_RELEASE" {
description = "Release of the package to build, used for rpm packages. This to set the _release macro, which is an incremental number for builds of the same release (Version: / #rpmVersion)."
default = null
}
variable "RUNC_REF" {
description = "Reference (branch, tag, commit) of runc to build. Only used for containerd package. If not set, defaults to the version specified in containerd's script/setup/runc-version file."
default = null
}
variable "NIGHTLY_BUILD" {
description = "Set to 1 to enforce nightly build."
default = null
}
variable "GO_IMAGE" {
description = "Go image to use for building packages."
default = "golang"
}
variable "GO_VERSION" {
description = "Go version to use for building packages."
default = null
}
variable "GO_IMAGE_VARIANT" {
description = "Go image variant to use for building packages."
default = "bookworm"
}
variable "LOCAL_PLATFORM" {
description = "Set to the current platform's default platform specification to build only for the local platform. If null, all platforms for the distro and package will be built."
default = null
}
variable "BUILD_CACHE_REGISTRY_SLUG" {
description = "Slug for the registry cache exporter."
default = "dockereng/packaging-cache"
}
variable "BUILD_CACHE_REGISTRY_PUSH" {
description = "Set to 1 to enable pushing to the registry cache exporter."
default = ""
}
#
# distros configurations
#
target "_distro-static" {
args = {
DISTRO_NAME = ""
DISTRO_TYPE = "static"
DISTRO_RELEASE = "static"
DISTRO_ID = ""
DISTRO_SUITE = ""
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "debian:trixie"
TEST_ONLY = "0"
}
}
target "_distro-debian11" {
args = {
DISTRO_NAME = "debian11"
DISTRO_TYPE = "deb"
DISTRO_RELEASE = "debian"
DISTRO_ID = "11"
DISTRO_SUITE = "bullseye"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "debian:bullseye"
TEST_ONLY = "0"
}
}
target "_distro-debian12" {
args = {
DISTRO_NAME = "debian12"
DISTRO_TYPE = "deb"
DISTRO_RELEASE = "debian"
DISTRO_ID = "12"
DISTRO_SUITE = "bookworm"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "debian:bookworm"
TEST_ONLY = "0"
}
}
target "_distro-debian13" {
args = {
DISTRO_NAME = "debian13"
DISTRO_TYPE = "deb"
DISTRO_RELEASE = "debian"
DISTRO_ID = "13"
DISTRO_SUITE = "trixie"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "debian:trixie"
TEST_ONLY = "0"
}
}
target "_distro-ubuntu2204" {
args = {
DISTRO_NAME = "ubuntu2204"
DISTRO_TYPE = "deb"
DISTRO_RELEASE = "ubuntu"
DISTRO_ID = "22.04"
DISTRO_SUITE = "jammy"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "ubuntu:jammy"
TEST_ONLY = "0"
}
}
target "_distro-ubuntu2404" {
args = {
DISTRO_NAME = "ubuntu2404"
DISTRO_TYPE = "deb"
DISTRO_RELEASE = "ubuntu"
DISTRO_ID = "24.04"
DISTRO_SUITE = "noble"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "ubuntu:noble"
TEST_ONLY = "0"
}
}
target "_distro-ubuntu2510" {
args = {
DISTRO_NAME = "ubuntu2510"
DISTRO_TYPE = "deb"
DISTRO_RELEASE = "ubuntu"
DISTRO_ID = "25.10"
DISTRO_SUITE = "questing"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "ubuntu:questing"
TEST_ONLY = "0"
}
}
target "_distro-ubuntu2604" {
args = {
DISTRO_NAME = "ubuntu2604"
DISTRO_TYPE = "deb"
DISTRO_RELEASE = "ubuntu"
DISTRO_ID = "26.04"
DISTRO_SUITE = "resolute"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "ubuntu:resolute"
TEST_ONLY = "0"
}
}
target "_distro-almalinux8" {
args = {
DISTRO_NAME = "almalinux8"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "almalinux"
DISTRO_ID = "8"
DISTRO_SUITE = "8"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "almalinux:8"
TEST_ONLY = "1"
}
}
target "_distro-almalinux9" {
args = {
DISTRO_NAME = "almalinux9"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "almalinux"
DISTRO_ID = "9"
DISTRO_SUITE = "9"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "almalinux:9"
TEST_ONLY = "1"
}
}
target "_distro-centos9" {
args = {
DISTRO_NAME = "centos9"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "centos"
DISTRO_ID = "9"
DISTRO_SUITE = "9"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "quay.io/centos/centos:stream9"
TEST_ONLY = "0"
}
}
target "_distro-centos10" {
args = {
DISTRO_NAME = "centos10"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "centos"
DISTRO_ID = "10"
DISTRO_SUITE = "10"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "quay.io/centos/centos:stream10"
TEST_ONLY = "0"
}
}
target "_distro-fedora42" {
args = {
DISTRO_NAME = "fedora42"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "fedora"
DISTRO_ID = "42"
DISTRO_SUITE = "42"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "fedora:42"
TEST_ONLY = "0"
}
}
target "_distro-fedora43" {
args = {
DISTRO_NAME = "fedora43"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "fedora"
DISTRO_ID = "43"
DISTRO_SUITE = "43"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "fedora:43"
TEST_ONLY = "0"
}
}
target "_distro-fedora44" {
args = {
DISTRO_NAME = "fedora44"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "fedora"
DISTRO_ID = "44"
DISTRO_SUITE = "44"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "fedora:44"
TEST_ONLY = "0"
}
}
target "_distro-oraclelinux8" {
args = {
DISTRO_NAME = "oraclelinux8"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "oraclelinux"
DISTRO_ID = "8"
DISTRO_SUITE = "8"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "oraclelinux:8"
TEST_ONLY = "1"
}
}
target "_distro-oraclelinux9" {
args = {
DISTRO_NAME = "oraclelinux9"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "oraclelinux"
DISTRO_ID = "9"
DISTRO_SUITE = "9"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "oraclelinux:9"
TEST_ONLY = "1"
}
}
target "_distro-rhel8" {
args = {
DISTRO_NAME = "rhel8"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "rhel"
DISTRO_ID = "8"
DISTRO_SUITE = "8"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "registry.access.redhat.com/ubi8/ubi"
TEST_ONLY = "0"
}
}
target "_distro-rhel9" {
args = {
DISTRO_NAME = "rhel9"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "rhel"
DISTRO_ID = "9"
DISTRO_SUITE = "9"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "registry.access.redhat.com/ubi9/ubi"
TEST_ONLY = "0"
}
}
target "_distro-rhel10" {
args = {
DISTRO_NAME = "rhel10"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "rhel"
DISTRO_ID = "10"
DISTRO_SUITE = "10"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "registry.access.redhat.com/ubi10/ubi"
TEST_ONLY = "0"
}
}
target "_distro-rockylinux8" {
args = {
DISTRO_NAME = "rockylinux8"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "rockylinux"
DISTRO_ID = "8"
DISTRO_SUITE = "8"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "rockylinux/rockylinux:8"
TEST_ONLY = "1"
}
}
target "_distro-rockylinux9" {
args = {
DISTRO_NAME = "rockylinux9"
DISTRO_TYPE = "rpm"
DISTRO_RELEASE = "rockylinux"
DISTRO_ID = "9"
DISTRO_SUITE = "9"
DISTRO_IMAGE = DISTRO_IMAGE != null && DISTRO_IMAGE != "" ? DISTRO_IMAGE : "rockylinux/rockylinux:9"
TEST_ONLY = "1"
}
}
# Returns the list of supported platforms for a given distro and package.
# The result is the intersection of the platforms supported by the distro
# and the platforms supported by the package. Except for static distro,
# where we return all the platforms supported by the package as we are
# doing cross-compilation.
function "distroPlatforms" {
params = [distro, pkg]
result = distro == "static" ? pkgPlatforms(pkg) : setsubtract(
setintersection(
lookup({
static = pkgPlatforms(pkg)
debian11 = ["linux/386", "linux/amd64", "linux/arm64", "linux/arm/v7", "linux/mips64le", "linux/ppc64le", "linux/s390x"]
debian12 = ["linux/386", "linux/amd64", "linux/arm64", "linux/arm/v7", "linux/mips64le", "linux/ppc64le", "linux/s390x"]
debian13 = ["linux/386", "linux/amd64", "linux/arm64", "linux/arm/v7", "linux/mips64le", "linux/ppc64le", "linux/riscv64", "linux/s390x"]
ubuntu2204 = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/ppc64le", "linux/s390x"]
ubuntu2404 = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/ppc64le", "linux/riscv64", "linux/s390x"]
ubuntu2510 = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/ppc64le", "linux/riscv64", "linux/s390x"]
ubuntu2604 = ["linux/amd64", "linux/arm64", "linux/arm/v7", "linux/ppc64le", "linux/riscv64", "linux/s390x"]
almalinux8 = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]
almalinux9 = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]
centos9 = ["linux/amd64", "linux/arm64", "linux/ppc64le"]
centos10 = ["linux/amd64", "linux/arm64", "linux/ppc64le"]
fedora42 = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]
fedora43 = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]
fedora44 = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]
oraclelinux8 = ["linux/amd64", "linux/arm64"]
oraclelinux9 = ["linux/amd64", "linux/arm64"]
rhel8 = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]
rhel9 = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]
rhel10 = ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"]
rockylinux8 = ["linux/amd64", "linux/arm64"]
rockylinux9 = ["linux/amd64", "linux/arm64"]
}, distro, []),
pkgPlatforms(pkg)
),
# FIXME: add linux/ppc64le when a remote PowerPC instance is available (too slow with QEMU)
# FIXME: add linux/riscv64 when a remote RISC-V instance is available (too slow with QEMU)
# FIXME: add linux/s390x when a remote LinuxONE instance is reachable again (too slow with QEMU)
["linux/ppc64le", "linux/riscv64", "linux/s390x"]
)
}
# Returns the list of secrets to use for a given distro.
function "distroSecrets" {
params = [distro]
result = length(regexall("^rhel", distro)) > 0 ? ["type=env,id=RH_USER,env=RH_USER", "type=env,id=RH_PASS,env=RH_PASS"] : []
}
#
# pkgs configurations
#
target "_pkg-buildx" {
args = {
PKG_NAME = PKG_NAME != null && PKG_NAME != "" ? PKG_NAME : "docker-buildx-plugin"
PKG_REPO = PKG_REPO != null && PKG_REPO != "" ? PKG_REPO : "https://github.com/docker/buildx.git"
PKG_REF = PKG_REF != null && PKG_REF != "" ? PKG_REF : "master"
GO_VERSION = GO_VERSION != null && GO_VERSION != "" ? GO_VERSION : "1.25" # https://github.com/docker/buildx/blob/master/Dockerfile
GO_IMAGE_VARIANT = GO_IMAGE_VARIANT != null && GO_IMAGE_VARIANT != "" ? GO_IMAGE_VARIANT : "bookworm"
PKG_DEB_EPOCH = PKG_DEB_EPOCH != null && PKG_DEB_EPOCH != "" ? PKG_DEB_EPOCH : ""
PKG_REMOTE_DOCKERFILE = "Dockerfile"
}
}
target "_pkg-compose" {
args = {
PKG_NAME = PKG_NAME != null && PKG_NAME != "" ? PKG_NAME : "docker-compose-plugin"
PKG_REPO = PKG_REPO != null && PKG_REPO != "" ? PKG_REPO : "https://github.com/docker/compose.git"
PKG_REF = PKG_REF != null && PKG_REF != "" ? PKG_REF : "main"
GO_VERSION = GO_VERSION != null && GO_VERSION != "" ? GO_VERSION : "1.25.8" # https://github.com/docker/compose/blob/main/Dockerfile
GO_IMAGE_VARIANT = GO_IMAGE_VARIANT != null && GO_IMAGE_VARIANT != "" ? GO_IMAGE_VARIANT : "bookworm"
PKG_DEB_EPOCH = PKG_DEB_EPOCH != null && PKG_DEB_EPOCH != "" ? PKG_DEB_EPOCH : ""
PKG_REMOTE_DOCKERFILE = "Dockerfile"
}
}
target "_pkg-containerd" {
args = {
PKG_NAME = PKG_NAME != null && PKG_NAME != "" ? PKG_NAME : "containerd.io"
PKG_REPO = PKG_REPO != null && PKG_REPO != "" ? PKG_REPO : "https://github.com/containerd/containerd.git"
PKG_REF = PKG_REF != null && PKG_REF != "" ? PKG_REF : "main"
GO_VERSION = GO_VERSION != null && GO_VERSION != "" ? GO_VERSION : "1.25.8" # https://github.com/containerd/containerd/blob/main/.github/workflows/release/Dockerfile
GO_IMAGE_VARIANT = GO_IMAGE_VARIANT != null && GO_IMAGE_VARIANT != "" ? GO_IMAGE_VARIANT : "bookworm"
PKG_DEB_EPOCH = PKG_DEB_EPOCH != null && PKG_DEB_EPOCH != "" ? PKG_DEB_EPOCH : ""
RUNC_REF = RUNC_REF != null && RUNC_REF != "" ? RUNC_REF : null
PKG_REMOTE_DOCKERFILE = ".github/workflows/release/Dockerfile"
}
}
target "_pkg-credential-helpers" {
args = {
PKG_NAME = PKG_NAME != null && PKG_NAME != "" ? PKG_NAME : "docker-credential-helpers"
PKG_REPO = PKG_REPO != null && PKG_REPO != "" ? PKG_REPO : "https://github.com/docker/docker-credential-helpers.git"
PKG_REF = PKG_REF != null && PKG_REF != "" ? PKG_REF : "main"
GO_VERSION = GO_VERSION != null && GO_VERSION != "" ? GO_VERSION : "1.25.8" # https://github.com/docker/docker-credential-helpers/blob/main/Dockerfile
GO_IMAGE_VARIANT = GO_IMAGE_VARIANT != null && GO_IMAGE_VARIANT != "" ? GO_IMAGE_VARIANT : "bookworm"
PKG_DEB_EPOCH = PKG_DEB_EPOCH != null && PKG_DEB_EPOCH != "" ? PKG_DEB_EPOCH : ""
PKG_REMOTE_DOCKERFILE = "Dockerfile"
}
}
target "_pkg-docker-cli" {
args = {
PKG_NAME = PKG_NAME != null && PKG_NAME != "" ? PKG_NAME : "docker-ce-cli"
PKG_REPO = PKG_REPO != null && PKG_REPO != "" ? PKG_REPO : "https://github.com/docker/cli.git"
PKG_REF = PKG_REF != null && PKG_REF != "" ? PKG_REF : "master"
GO_VERSION = GO_VERSION != null && GO_VERSION != "" ? GO_VERSION : "1.25.8" # https://github.com/docker/cli/blob/master/Dockerfile
GO_IMAGE_VARIANT = GO_IMAGE_VARIANT != null && GO_IMAGE_VARIANT != "" ? GO_IMAGE_VARIANT : "bookworm"
PKG_DEB_EPOCH = PKG_DEB_EPOCH != null && PKG_DEB_EPOCH != "" ? PKG_DEB_EPOCH : "5"
PKG_REMOTE_DOCKERFILE = "Dockerfile"
}
}
target "_pkg-docker-engine" {
args = {
PKG_NAME = PKG_NAME != null && PKG_NAME != "" ? PKG_NAME : "docker-ce"
PKG_REPO = PKG_REPO != null && PKG_REPO != "" ? PKG_REPO : "https://github.com/docker/docker.git"
PKG_REF = PKG_REF != null && PKG_REF != "" ? PKG_REF : "master"
GO_VERSION = GO_VERSION != null && GO_VERSION != "" ? GO_VERSION : "1.25.8" # https://github.com/moby/moby/blob/master/Dockerfile
GO_IMAGE_VARIANT = GO_IMAGE_VARIANT != null && GO_IMAGE_VARIANT != "" ? GO_IMAGE_VARIANT : "bookworm"
PKG_DEB_EPOCH = PKG_DEB_EPOCH != null && PKG_DEB_EPOCH != "" ? PKG_DEB_EPOCH : "5"
PKG_REMOTE_DOCKERFILE = "Dockerfile"
}
}
target "_pkg-model" {
args = {
PKG_NAME = PKG_NAME != null && PKG_NAME != "" ? PKG_NAME : "docker-model-plugin"
PKG_REPO = PKG_REPO != null && PKG_REPO != "" ? PKG_REPO : "https://github.com/docker/model-runner.git"
PKG_REF = PKG_REF != null && PKG_REF != "" ? PKG_REF : "main"
GO_VERSION = GO_VERSION != null && GO_VERSION != "" ? GO_VERSION : "1.25" # https://github.com/docker/model-runner/blob/main/cmd/cli/Dockerfile
GO_IMAGE_VARIANT = GO_IMAGE_VARIANT != null && GO_IMAGE_VARIANT != "" ? GO_IMAGE_VARIANT : "bookworm"
PKG_DEB_EPOCH = PKG_DEB_EPOCH != null && PKG_DEB_EPOCH != "" ? PKG_DEB_EPOCH : ""
PKG_REMOTE_DOCKERFILE = "Dockerfile"
}
}
target "_pkg-agent" {
args = {
PKG_NAME = PKG_NAME != null && PKG_NAME != "" ? PKG_NAME : "docker-agent-plugin"
PKG_REPO = PKG_REPO != null && PKG_REPO != "" ? PKG_REPO : "https://github.com/docker/docker-agent.git"
PKG_REF = PKG_REF != null && PKG_REF != "" ? PKG_REF : "main"
GO_VERSION = GO_VERSION != null && GO_VERSION != "" ? GO_VERSION : "1.26.1" # https://github.com/docker/docker-agent/blob/main/Dockerfile
GO_IMAGE_VARIANT = GO_IMAGE_VARIANT != null && GO_IMAGE_VARIANT != "" ? GO_IMAGE_VARIANT : "bookworm"
PKG_DEB_EPOCH = PKG_DEB_EPOCH != null && PKG_DEB_EPOCH != "" ? PKG_DEB_EPOCH : ""
PKG_REMOTE_DOCKERFILE = "Dockerfile"
}
}
# Returns the list of supported platforms for a given package.
function "pkgPlatforms" {
params = [pkg]
result = lookup({
# https://github.com/docker/buildx/blob/0c747263ef1426f5fa217fcdb616eddf33da6c2d/docker-bake.hcl#L156-L174
buildx = ["darwin/amd64", "darwin/arm64", "linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/ppc64le", "linux/riscv64", "linux/s390x", "windows/amd64", "windows/arm64"]
# https://github.com/docker/compose/blob/c626befee1596abcc74578cb10dd96ae1667f76f/docker-bake.hcl#L112-L124
compose = ["darwin/amd64", "darwin/arm64", "linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/ppc64le", "linux/riscv64", "linux/s390x", "windows/amd64", "windows/arm64"]
# https://github.com/containerd/containerd/blob/87742bd35f6ddc47c638a448c271b7ccf8df9010/.github/workflows/ci.yml#L145-L165
# https://github.com/containerd/containerd/blob/87742bd35f6ddc47c638a448c271b7ccf8df9010/.github/workflows/ci.yml#L135-L137
containerd = ["linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/ppc64le", "linux/s390x", "windows/amd64", "windows/arm64", "windows/arm/v7"]
# https://github.com/docker/docker-credential-helpers/blob/f9d3010165b642df37215b1be945552f2c6f0e3b/docker-bake.hcl#L56-L66
credential-helpers = ["darwin/amd64", "darwin/arm64", "linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/ppc64le", "linux/s390x", "windows/amd64"]
# https://github.com/docker/cli/blob/84038691220e7ba3329a177e4e3357b4ee0e3a52/docker-bake.hcl#L30-L42
docker-cli = ["darwin/amd64", "darwin/arm64", "linux/386", "linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/ppc64le", "linux/riscv64", "linux/s390x", "windows/amd64", "windows/arm64"]
# https://github.com/moby/moby/blob/83264918d3e1c61341511e360a7277150b914b3f/docker-bake.hcl#L82-L91
docker-engine = ["linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/ppc64le", "linux/s390x", "windows/amd64", "windows/arm64"]
# https://github.com/docker/model-runner/blob/039f7a31c0365f9161c9b9b6bb3888161d16e388/cmd/cli/Makefile#L39-L43
model = ["darwin/amd64", "darwin/arm64", "linux/amd64", "linux/arm64", "linux/arm/v7", "windows/amd64", "windows/arm64"]
# https://github.com/docker/docker-agent/blob/5b9feaabe743a5ad577f2247ed55d5dcb2678e8b/Taskfile.yml#L79
agent = ["darwin/amd64", "darwin/arm64", "linux/amd64", "linux/arm64", "windows/amd64", "windows/arm64"]
}, pkg, [])
}
#
#
#
target "_common" {
args = {
BUILDKIT_MULTI_PLATFORM = 1
NIGHTLY_BUILD = NIGHTLY_BUILD
GO_IMAGE = GO_IMAGE
GO_VERSION = GO_VERSION
GO_IMAGE_VARIANT = GO_IMAGE_VARIANT
PKG_NAME = PKG_NAME
PKG_REPO = PKG_REPO
PKG_REF = PKG_REF
PKG_VENDOR = PKG_VENDOR
PKG_PACKAGER = PKG_PACKAGER
PKG_DEB_BUILDFLAGS = PKG_DEB_BUILDFLAGS
PKG_DEB_REVISION = PKG_DEB_REVISION
PKG_DEB_EPOCH = PKG_DEB_EPOCH
PKG_RPM_BUILDFLAGS = PKG_RPM_BUILDFLAGS
PKG_RPM_RELEASE = PKG_RPM_RELEASE
RUNC_REF = RUNC_REF
}
}
# Special target: https://github.com/docker/metadata-action#bake-definition
target "meta-helper" {
tags = ["dockereng/packaging:local"]
}
group "default" {
targets = ["validate"]
}
target "pkg" {
name = "pkg-${pkg}-${distro}"
description = "Build ${pkg} package for ${distro}"
inherits = ["_common", "_distro-${distro}", "_pkg-${pkg}"]
matrix = {
pkg = PKGS
distro = DISTROS
}
context = "./pkg/${pkg}"
contexts = {
scripts = "./hack/scripts"
}
output = ["type=local,dest=./bin/pkg/${pkg}/${distro}"]
# BAKE_LOCAL_PLATFORM is a built-in var returning the current platform's
# default platform specification: https://docs.docker.com/build/customize/bake/file-definition/#built-in-variables
platforms = LOCAL_PLATFORM != null ? [BAKE_LOCAL_PLATFORM] : distroPlatforms(distro, pkg)
secret = distroSecrets(distro)
attest = [
"type=sbom",
"type=provenance,mode=max"
]
}
target "verify" {
name = "verify-${pkg}-${distro}"
description = "Verify ${pkg} package for ${distro}"
inherits = ["_common", "_distro-${distro}", "_pkg-${pkg}"]
matrix = {
pkg = PKGS
distro = DISTROS
}
context = "./pkg/${pkg}"
dockerfile = "verify.Dockerfile"
contexts = {
scripts = "./hack/scripts"
bin = "./bin/pkg/${pkg}/${distro}"
}
no-cache = true
output = ["type=cacheonly"]
}
# Create release image by using ./bin folder as named context. Make sure all
# pkg targets are called before releasing
target "release" {
name = "release-${pkg}"
description = "Release ${pkg} package"
inherits = ["_common", "meta-helper", "_pkg-${pkg}"]
matrix = {
pkg = PKGS
}
dockerfile = "./hack/release.Dockerfile"
contexts = {
bin = "./bin/pkg/${pkg}"
}
platforms = pkgPlatforms(pkg)
}
target "metadata" {
name = "metadata-${pkg}"
description = "Generate metadata for ${pkg} package"
inherits = ["_common", "_pkg-${pkg}"]
matrix = {
pkg = PKGS
}
context = "./pkg/${pkg}"
contexts = {
scripts = "./hack/scripts"
}
target = "metadata"
output = ["./bin/pkg/${pkg}"]
args = {
BUILDKIT_MULTI_PLATFORM = 0
}
}
group "validate" {
targets = ["license-validate"]
}
target "license-validate" {
target = "license-validate"
output = ["type=cacheonly"]
}
target "license-update" {
target = "license-update"
output = ["."]
}