-
Notifications
You must be signed in to change notification settings - Fork 20
/
docker-bake.hcl
73 lines (56 loc) · 1.34 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# docker-bake.hcl
# Build configuration variables
variable "REGISTRY" {
default = "us-docker.pkg.dev"
}
variable "REPOSITORY" {
default = "forgeops-public/images"
}
variable "CACHE_REGISTRY" {
default = REGISTRY
}
variable "CACHE_REPOSITORY" {
default = REPOSITORY
}
variable "NO_CACHE" {
default = false
}
variable "PULL" {
default = true
}
variable "BUILD_ARCH" {
default = "amd64,arm64"
}
variable "BUILD_TAG" {
default = "dev"
}
# Helper functions
function "platforms" {
params = [BUILD_ARCH]
result = "${formatlist("linux/%s", "${split(",", "${BUILD_ARCH}")}")}"
}
function "tags" {
params = [REGISTRY, REPOSITORY, image, BUILD_TAG]
result = "${formatlist("${REGISTRY}/${REPOSITORY}/${image}:%s", "${split(",", "${BUILD_TAG}")}")}"
}
# Build targets
group "default" {
targets = [
"secret-agent",
]
}
target "base" {
context = "."
platforms = "${platforms("${BUILD_ARCH}")}"
no-cache = NO_CACHE
pull = PULL
output = ["type=registry"]
}
target "secret-agent" {
inherits = ["base"]
context = "."
dockerfile = "Dockerfile"
tags = "${tags("${REGISTRY}", "${REPOSITORY}", "secret-agent", "${BUILD_TAG}")}"
cache-to = ["mode=max,type=registry,ref=${CACHE_REGISTRY}/${CACHE_REPOSITORY}/ds:build-cache"]
cache-from = ["type=registry,ref=${CACHE_REGISTRY}/${CACHE_REPOSITORY}/secret-agent:build-cache"]
}