forked from piraeusdatastore/piraeus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
153 lines (136 loc) · 3.38 KB
/
docker-bake.hcl
File metadata and controls
153 lines (136 loc) · 3.38 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
variable "DISTRO" {
default = "bookworm"
}
variable "GIT_COMMIT" {
default = ""
}
variable "LATEST" {
default = "true"
}
variable "CACHE" {
default = false
}
variable VERSIONS {
default = {
DRBD = ["9.2.12", "9.1.23"]
DRBD_REACTOR = "1.7.0-1"
K8S_AWAIT_ELECTION = "v0.4.1"
KTLS_UTILS = "0.11-1"
LINSTOR = "1.30.3-1"
}
}
variable "REGISTRIES" {
default = "quay.io/piraeusdatastore,docker.io/piraeusdatastore"
}
# Replace all characters that are not supported in a target name with "-".
function "escape" {
params = [string]
result = "${regex_replace(string, "[^a-zA-Z0-9_-]", "-")}"
}
# Generate tags based for all images
function "tags" {
params = [name, version]
result = flatten([
for registry in split(",", REGISTRIES) :
[
// Full version
"${registry}/${name}:v${version}",
// Version shortened by the release
"${registry}/${name}:v${regex("^[^-]+", version)}",
// Full version + git commit, if set
notequal("", GIT_COMMIT) ? "${registry}/${name}:v${version}-g${GIT_COMMIT}" : "",
// Mark as latest, unless explicitly disabled
equal("true", LATEST) ? "${registry}/${name}:latest" : "",
]
])
}
# Generate a cache-to configuration
function "cache-to" {
params = [name]
result = CACHE ? ["type=gha,scope=${name},mode=max"] : []
}
# Generate a cache-from configuration
function "cache-from" {
params = [name]
result = CACHE ? ["type=gha,scope=${name}"] : []
}
group "default" {
targets = [
"drbd-reactor",
"drbd-driver-loader",
"ktls-utils",
"piraeus-server",
]
}
target "base" {
dockerfile = "base.Dockerfile"
inherits = ["common"]
args = {
DISTRO = DISTRO
}
}
target "common" {
platforms = ["linux/amd64", "linux/arm64"]
}
target "piraeus-server" {
inherits = ["common"]
tags = tags("piraeus-server", VERSIONS["LINSTOR"])
cache-from = cache-from("piraeus-server")
cache-to = cache-to("piraeus-server")
context = "piraeus-server"
contexts = { base = "target:base" }
args = {
LINSTOR_VERSION = VERSIONS["LINSTOR"]
K8S_AWAIT_ELECTION_VERSION = VERSIONS["K8S_AWAIT_ELECTION"]
}
}
target "ktls-utils" {
inherits = ["common"]
tags = tags("ktls-utils", VERSIONS["KTLS_UTILS"])
cache-from = cache-from("ktls-utils")
cache-to = cache-to("ktls-utils")
context = "ktls-utils"
contexts = { base = "target:base" }
args = {
KTLS_UTILS_VERSION = VERSIONS["KTLS_UTILS"]
}
}
target "drbd-reactor" {
inherits = ["common"]
tags = tags("drbd-reactor", VERSIONS["DRBD_REACTOR"])
cache-from = cache-from("drbd-reactor")
cache-to = cache-to("drbd-reactor")
context = "drbd-reactor"
contexts = { base = "target:base" }
args = {
DRBD_REACTOR_VERSION = VERSIONS["DRBD_REACTOR"]
}
}
target "drbd-driver-loader" {
name = "drbd-driver-loader-${distro}-${escape(drbd_version)}"
inherits = ["common"]
tags = tags("drbd9-${distro}", drbd_version)
cache-from = cache-from("drbd9-${distro}")
cache-to = cache-to("drbd9-${distro}")
context = "drbd-driver-loader"
dockerfile = "Dockerfile.${distro}"
matrix = {
drbd_version = VERSIONS["DRBD"]
distro = [
"centos7",
"centos8",
"almalinux8",
"almalinux9",
"bionic",
"focal",
"jammy",
"noble",
"bullseye",
"buster",
"bookworm",
]
}
args = {
DRBD_VERSION = drbd_version
}
}