Skip to content

Commit 0ddcb6e

Browse files
authored
chore: reorder docker bake file (#590)
1 parent 18f8410 commit 0ddcb6e

File tree

1 file changed

+92
-89
lines changed

1 file changed

+92
-89
lines changed

docker-bake.hcl

Lines changed: 92 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
1-
group "linux" {
2-
targets = [
3-
"alpine",
4-
"debian",
5-
]
6-
}
7-
8-
group "windows" {
9-
targets = [
10-
"nanoserver",
11-
"windowsservercore"
12-
]
13-
}
14-
15-
group "linux-arm64" {
16-
targets = [
17-
"debian",
18-
"alpine_jdk21",
19-
]
20-
}
21-
22-
group "linux-s390x" {
23-
targets = [
24-
"debian_jdk21"
25-
]
26-
}
27-
28-
group "linux-ppc64le" {
29-
targets = [
30-
"debian"
31-
]
32-
}
33-
1+
## Variables
342
variable "jdks_to_build" {
353
default = [17, 21, 25]
364
}
@@ -84,62 +52,7 @@ variable "WINDOWS_VERSION_OVERRIDE" {
8452
default = ""
8553
}
8654

87-
## Common functions
88-
# Return "true" if the jdk passed as parameter is the same as the default jdk, "false" otherwise
89-
function "is_default_jdk" {
90-
params = [jdk]
91-
result = equal(default_jdk, jdk) ? "true" : "false"
92-
}
93-
94-
# Return the complete Java version corresponding to the jdk passed as parameter
95-
function "javaversion" {
96-
params = [jdk]
97-
result = (equal(17, jdk)
98-
? "${JAVA17_VERSION}"
99-
: equal(21, jdk)
100-
? "${JAVA21_VERSION}"
101-
: "${JAVA25_VERSION}")
102-
}
103-
104-
## Specific functions
105-
# Return an array of Alpine platforms to use depending on the jdk passed as parameter
106-
function "alpine_platforms" {
107-
params = [jdk]
108-
result = (equal(17, jdk)
109-
? ["linux/amd64"]
110-
: ["linux/amd64", "linux/arm64"])
111-
}
112-
113-
# Return an array of Debian platforms to use depending on the jdk passed as parameter
114-
function "debian_platforms" {
115-
params = [jdk]
116-
result = (equal(17, jdk)
117-
? ["linux/amd64", "linux/arm64", "linux/ppc64le"]
118-
: ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"])
119-
}
120-
121-
# Return array of Windows version(s) to build
122-
# There is no mcr.microsoft.com/windows/servercore:1809 image
123-
# Can be overriden by setting WINDOWS_VERSION_OVERRIDE to a specific Windows version
124-
# Ex: WINDOWS_VERSION_OVERRIDE=1809 docker buildx bake windows
125-
function "windowsversions" {
126-
params = [flavor]
127-
result = (notequal(WINDOWS_VERSION_OVERRIDE, "")
128-
? [WINDOWS_VERSION_OVERRIDE]
129-
: (equal(flavor, "windowsservercore")
130-
? ["ltsc2019", "ltsc2022"]
131-
: ["1809", "ltsc2019", "ltsc2022"]))
132-
}
133-
134-
# Return the Windows version to use as base image for the Windows version passed as parameter
135-
# There is no mcr.microsoft.com/powershell ltsc2019 base image, using a "1809" instead
136-
function "toolsversion" {
137-
params = [version]
138-
result = (equal("ltsc2019", version)
139-
? "1809"
140-
: version)
141-
}
142-
55+
## Targets
14356
target "alpine" {
14457
matrix = {
14558
jdk = jdks_to_build
@@ -244,3 +157,93 @@ target "windowsservercore" {
244157
]
245158
platforms = ["windows/amd64"]
246159
}
160+
161+
## Groups
162+
group "linux" {
163+
targets = [
164+
"alpine",
165+
"debian",
166+
]
167+
}
168+
169+
group "windows" {
170+
targets = [
171+
"nanoserver",
172+
"windowsservercore"
173+
]
174+
}
175+
176+
group "linux-arm64" {
177+
targets = [
178+
"debian",
179+
"alpine_jdk21",
180+
]
181+
}
182+
183+
group "linux-s390x" {
184+
targets = [
185+
"debian_jdk21"
186+
]
187+
}
188+
189+
group "linux-ppc64le" {
190+
targets = [
191+
"debian"
192+
]
193+
}
194+
195+
## Common functions
196+
# Return "true" if the jdk passed as parameter is the same as the default jdk, "false" otherwise
197+
function "is_default_jdk" {
198+
params = [jdk]
199+
result = equal(default_jdk, jdk) ? "true" : "false"
200+
}
201+
202+
# Return the complete Java version corresponding to the jdk passed as parameter
203+
function "javaversion" {
204+
params = [jdk]
205+
result = (equal(17, jdk)
206+
? "${JAVA17_VERSION}"
207+
: equal(21, jdk)
208+
? "${JAVA21_VERSION}"
209+
: "${JAVA25_VERSION}")
210+
}
211+
212+
## Specific functions
213+
# Return an array of Alpine platforms to use depending on the jdk passed as parameter
214+
function "alpine_platforms" {
215+
params = [jdk]
216+
result = (equal(17, jdk)
217+
? ["linux/amd64"]
218+
: ["linux/amd64", "linux/arm64"])
219+
}
220+
221+
# Return an array of Debian platforms to use depending on the jdk passed as parameter
222+
function "debian_platforms" {
223+
params = [jdk]
224+
result = (equal(17, jdk)
225+
? ["linux/amd64", "linux/arm64", "linux/ppc64le"]
226+
: ["linux/amd64", "linux/arm64", "linux/ppc64le", "linux/s390x"])
227+
}
228+
229+
# Return array of Windows version(s) to build
230+
# There is no mcr.microsoft.com/windows/servercore:1809 image
231+
# Can be overriden by setting WINDOWS_VERSION_OVERRIDE to a specific Windows version
232+
# Ex: WINDOWS_VERSION_OVERRIDE=1809 docker buildx bake windows
233+
function "windowsversions" {
234+
params = [flavor]
235+
result = (notequal(WINDOWS_VERSION_OVERRIDE, "")
236+
? [WINDOWS_VERSION_OVERRIDE]
237+
: (equal(flavor, "windowsservercore")
238+
? ["ltsc2019", "ltsc2022"]
239+
: ["1809", "ltsc2019", "ltsc2022"]))
240+
}
241+
242+
# Return the Windows version to use as base image for the Windows version passed as parameter
243+
# There is no mcr.microsoft.com/powershell ltsc2019 base image, using a "1809" instead
244+
function "toolsversion" {
245+
params = [version]
246+
result = (equal("ltsc2019", version)
247+
? "1809"
248+
: version)
249+
}

0 commit comments

Comments
 (0)