-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-bake.hcl
84 lines (70 loc) · 2.12 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
73
74
75
76
77
78
79
80
81
82
83
84
variable "APTOS_GIT_REF" {}
variable "PLATFORM" {}
variable "_PLATFORM_TAG" {
default = regex_replace(PLATFORM, "/", "-")
}
variable "_REMOTE_CACHE_BUILDER_BASE" {
default = "type=registry,ref=ghcr.io/shinamicorp/aptos:cache-builder-base-${_PLATFORM_TAG}"
}
variable "_REMOTE_CACHE_RUNTIME_BASE" {
default = "type=registry,ref=ghcr.io/shinamicorp/aptos:cache-runtime-base-${_PLATFORM_TAG}"
}
variable "_REMOTE_CACHE_BINARIES" {
default = "type=registry,ref=ghcr.io/shinamicorp/aptos:cache-binaries-${APTOS_GIT_REF}-${_PLATFORM_TAG}"
}
function "tag" {
params = [target]
result = "ghcr.io/shinamicorp/${target}:${APTOS_GIT_REF}-${_PLATFORM_TAG}"
}
function "local_cache_dir" {
params = [target]
result = "./cache/${PLATFORM}/${target}"
}
target "_common" {
platforms = [PLATFORM]
args = {
APTOS_GIT_REF = APTOS_GIT_REF
}
cache-from = [
"type=local,src=${local_cache_dir("builder-base")}",
"type=local,src=${local_cache_dir("runtime-base")}",
"type=local,src=${local_cache_dir("binaries")}",
_REMOTE_CACHE_BUILDER_BASE,
_REMOTE_CACHE_RUNTIME_BASE,
_REMOTE_CACHE_BINARIES,
]
}
# These cache-only targets are just to download/populate the caches.
target "cache-builder-base" {
inherits = ["_common"]
target = "builder-base"
output = ["type=cacheonly"]
cache-to = ["type=local,dest=${local_cache_dir("builder-base")}", _REMOTE_CACHE_BUILDER_BASE]
}
target "cache-runtime-base" {
inherits = ["_common"]
target = "runtime-base"
output = ["type=cacheonly"]
cache-to = ["type=local,dest=${local_cache_dir("runtime-base")}", _REMOTE_CACHE_RUNTIME_BASE]
}
target "cache-binaries" {
inherits = ["_common"]
target = "binaries"
output = ["type=cacheonly"]
cache-to = ["type=local,dest=${local_cache_dir("binaries")}", _REMOTE_CACHE_BINARIES]
}
# Single-platform targets.
# Requires creating multi-platform manifest list manually.
target "aptos-node" {
inherits = ["_common"]
target = "aptos-node"
tags = [tag("aptos-node")]
}
target "aptos" {
inherits = ["_common"]
target = "aptos"
tags = [tag("aptos")]
}
target "default" {
inherits = ["aptos-node"]
}