forked from Princeton-CDH/cdh-web
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-bake.hcl
64 lines (53 loc) · 1.76 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
// this is cache definition used for caching purposes only
variable "CACHE" { default = "" }
// this is remote registry to push to
variable "REGISTRY" { default = "" }
variable "ENVIRONMENT" { default = "preview" }
variable "PROJECT" { default = "cdhweb" }
variable "VERSION" { default = "latest" }
// targets in groups are built in parallel
group "default" {
targets = ["tasks", "app"]
}
group "testing" {
targets = ["app-test"]
}
target "app" {
dockerfile = "docker/application/Dockerfile"
target = "app"
cache-from = notequal("", CACHE) ? ["${CACHE},name=app"] : []
cache-to = notequal("", CACHE) ? ["${CACHE},mode=max,name=app"] : []
args = {
VERSION : VERSION,
}
tags = notequal("", REGISTRY) ? [
"${REGISTRY}/${PROJECT}-app:${ENVIRONMENT}-latest",
"${REGISTRY}/${PROJECT}-app:${ENVIRONMENT}-${VERSION}",
"${REGISTRY}/${PROJECT}-app:common-${VERSION}",
] : []
}
target "app-test" {
dockerfile = "docker/application/Dockerfile"
target = "app-test"
cache-from = notequal("", CACHE) ? ["${CACHE},name=app-test", "${CACHE},name=base"] : []
cache-to = notequal("", CACHE) ? ["${CACHE},mode=max,name=app-test"] : []
args = {
VERSION : VERSION,
}
// this tag is different as we're going to load it
tags = ["${PROJECT}/app-test:${VERSION}"]
}
target "tasks" {
dockerfile = "docker/application/Dockerfile"
target = "tasks"
cache-from = notequal("", CACHE) ? ["${CACHE},name=tasks"] : []
cache-to = notequal("", CACHE) ? ["${CACHE},mode=max,name=tasks"] : []
args = {
VERSION : VERSION,
}
tags = notequal("", REGISTRY) ? [
"${REGISTRY}/${PROJECT}-tasks:${ENVIRONMENT}-latest",
"${REGISTRY}/${PROJECT}-tasks:${ENVIRONMENT}-${VERSION}",
"${REGISTRY}/${PROJECT}-tasks:common-${VERSION}",
] : []
}