-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
72 lines (70 loc) · 1.5 KB
/
docker-bake.hcl
File metadata and controls
72 lines (70 loc) · 1.5 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
# variables
variable "TAG" {
default = "latest"
}
variable "LINUX_DISTRO" {
default = "alpine"
}
variable "IMAGE_NAME" {
default = "alpine"
}
variable "BASE_IMAGE" {
default = "alpine"
}
variable "VERBOSE" {
default = ""
}
variable "REBUILD" {
default = ""
}
variable "ARCH" {
default = ""
}
function "tag" {
params = [suffix]
result = [format("${IMAGE_NAME}%s:${TAG}", notequal("${ARCH}", suffix) ? "-${suffix}" : "")]
}
# groups
group "dev" {
targets = ["${ARCH}"]
}
group "default" {
targets = ["${ARCH}"]
}
group "multi" {
targets = [
"amd64",
"arm64"
]
}
# intended for use with default local docker builder
# uses 'dev' group in docker-bake.hcl
# assume dev and default build for architecture of local machine
target "amd64" {
context = "."
dockerfile = "Dockerfile"
args = {
LINUX_DISTRO = "${LINUX_DISTRO}"
BASE_IMAGE = "${BASE_IMAGE}"
TAG = "${TAG}"
VERBOSE = "${VERBOSE}"
REBUILD = "${REBUILD}"
}
tags = tag("amd64")
platforms = ["linux/amd64"]
}
# intended for use with default docker driver on an arm64 machine
# use with 'arm' group
target "arm64" {
inherits = ["amd64"]
tags = tag("arm64")
platforms = ["linux/arm64"]
}
# must use with docker-container driver for multiarch image publish to hub.docker.com
# uses 'publish' group in docker-bake.hcl
target "publish" {
inherits = ["amd64"]
tags = ["${IMAGE_NAME}:${TAG}"]
platforms = ["linux/amd64", "linux/arm64"]
output = ["type=registry"]
}