-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdocker-bake.hcl
53 lines (47 loc) · 1.51 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
variable "TF_VERSION" {}
variable "GPU" {
default = false
}
variable "LATEST" {
default = false
}
function "semver" {
# IDX: MAJOR=0, MINOR=1, PATCH=2, SUFFIX=3
params = [vers, idx]
result = regex("^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", "${vers}")[idx]
}
group "default" {
targets = GPU ? ["build-cpu", "build-gpu"] : ["build-cpu"]
}
target "build-cpu" {
dockerfile = "./dockerfiles/tensorflow-${TF_VERSION}/cpu.Dockerfile"
platforms = [
"linux/amd64",
"linux/arm64"
]
tags = LATEST ? [
"wamuir/golang-tf:latest",
"wamuir/golang-tf:${TF_VERSION}",
"wamuir/golang-tf:${semver(TF_VERSION, 0)}",
"wamuir/golang-tf:${semver(TF_VERSION, 0)}.${semver(TF_VERSION, 1)}"
] : [
"wamuir/golang-tf:${TF_VERSION}",
"wamuir/golang-tf:${semver(TF_VERSION, 0)}.${semver(TF_VERSION, 1)}"
]
}
target "build-gpu" {
dockerfile = "./dockerfiles/tensorflow-${TF_VERSION}/gpu.Dockerfile"
platforms = [
"linux/amd64"
]
tags = LATEST ? [
"wamuir/golang-tf:gpu",
"wamuir/golang-tf:latest-gpu",
"wamuir/golang-tf:${TF_VERSION}-gpu",
"wamuir/golang-tf:${semver(TF_VERSION, 0)}-gpu",
"wamuir/golang-tf:${semver(TF_VERSION, 0)}.${semver(TF_VERSION, 1)}-gpu"
] : [
"wamuir/golang-tf:${TF_VERSION}-gpu",
"wamuir/golang-tf:${semver(TF_VERSION, 0)}.${semver(TF_VERSION, 1)}-gpu"
]
}