-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-bake.hcl
128 lines (111 loc) · 2.53 KB
/
docker-bake.hcl
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
variable "REPOSITORY" {
default = "claylinux"
}
variable "TAG" {
default = ""
}
variable "PLATFORMS" {
# comma-separated list of platform, e.g. "linux/amd64,linux/arm64", leave empty to use the default platform
default = ""
}
variable "FORMAT" {
# default format for the VM output
default = "efi"
}
group "lint" {
targets = ["yamllint", "hadolint", "shellcheck"]
}
target "shellcheck" {
inherits = ["_lint"]
target = "shellcheck"
}
target "hadolint" {
inherits = ["_lint"]
target = "hadolint"
}
target "yamllint" {
inherits = ["_lint"]
target = "yamllint"
}
target "_lint" {
dockerfile = "lint/Dockerfile"
output = ["type=cacheonly"]
}
group "default" {
targets = ["lint", "builder", "alpine-lts", "alpine-edge", "alpine-virt"]
}
group "all" {
targets = ["default", "test", "emulator"]
}
target "builder" {
inherits = ["_image"]
context = "builder"
tags = tags("builder")
}
# TODO: we should factor the alpine images
target "alpine-lts" {
inherits = ["_image"]
context = "alpine"
tags = tags("alpine-lts")
args = {
FLAVOR = "lts"
}
}
target "alpine-edge" {
inherits = ["_image"]
context = "alpine"
tags = tags("alpine-edge")
args = {
FLAVOR = "edge"
}
}
target "alpine-virt" {
inherits = ["_image"]
context = "alpine"
tags = tags("alpine-virt")
args = {
FLAVOR = "virt"
CMDLINE = "console=tty0 console=ttyS0"
INITTAB_TTYS = <<-EOF
tty1::respawn:/sbin/getty 38400 tty1
ttyS0::respawn:/sbin/getty -L 0 ttyS0 vt100
EOF
}
}
target "_image" {
target = "image"
pull = true
platforms = split(",", "${PLATFORMS}")
}
target "test" {
name = "test-${item.target}-${item.format}-${item.ucode}"
matrix = {
item = [
{format = "efi", ucode="intel", target="alpine-lts"},
{format = "iso", ucode="amd", target="alpine-lts"},
{format = "raw", ucode="intel", target="alpine-virt"},
{format = "qcow2", ucode="none", target="alpine-lts"},
{format = "efi", ucode="intel", target="alpine-edge"},
{format = "vmdk", ucode="none", target="alpine-virt"},
{format = "vhdx", ucode="none", target="alpine-virt"},
{format = "vdi", ucode="none", target="alpine-virt"}
]
}
context = "test"
output = ["type=cacheonly"]
contexts = {
"base" = "target:${item.target}"
"builder" = "target:builder"
}
args = {
FORMAT = "${item.format}"
UCODE = "${item.ucode}"
}
}
function "tags" {
params = [name]
result = [
"${REPOSITORY}/${name}:latest",
notequal(TAG, "") ? "${REPOSITORY}/${name}:${TAG}" : ""
]
}