-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-bake.hcl
62 lines (54 loc) · 991 Bytes
/
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
variable "REGISTRY" {
default = ""
}
variable "PLATFORMS" {
default = "linux/amd64"
}
variable "TAG" {
default = "latest"
}
variable GOPROXY {
default = ""
}
variable VERSION {
default = ""
}
group "default" {
targets = [
"linstor-operator"
]
}
function "escape" {
params = [string]
result = "${regex_replace(string, "[^a-zA-Z0-9_-]", "-")}"
}
function "platform_variants" {
params = [platforms]
result = concat([
{
prefix = ""
platforms = split(",", platforms)
}
], [
for plat in split(",", platforms) :
{
prefix = "${trimprefix(plat, "linux/")}/"
platforms = [plat]
}
])
}
target "linstor-operator" {
name = "${escape(platforms.prefix)}linstor-operator"
tags = [
"${REGISTRY}/${platforms.prefix}linstor-operator:${TAG}"
]
matrix = {
platforms = platform_variants(PLATFORMS)
}
args = {
GOPROXY = GOPROXY
VERSION = VERSION
}
context = "."
platforms = platforms.platforms
}