Skip to content

Commit 448c50a

Browse files
authored
fix: adding docker-bake file (#8)
Signed-off-by: Jacques Samain <[email protected]>
1 parent c4b009c commit 448c50a

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

docker-bake.hcl

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
5+
# Documentation available at: https://docs.docker.com/build/bake/
6+
7+
# Docker build args
8+
variable "IMAGE_REPO" { default = "" }
9+
variable "IMAGE_TAG" { default = "v0.0.0-dev" }
10+
11+
function "get_tag" {
12+
params = [tags, name]
13+
// Check if IMAGE_REPO ends with name to avoid repetition
14+
result = [for tag in tags:
15+
can(regex("${name}$", IMAGE_REPO)) ?
16+
"${IMAGE_REPO}:${tag}" :
17+
"${IMAGE_REPO}/${name}:${tag}"
18+
]
19+
}
20+
21+
group "default" {
22+
targets = [
23+
"slim",
24+
]
25+
}
26+
27+
group "data-plane" {
28+
targets = [
29+
"slim",
30+
]
31+
}
32+
33+
target "_common" {
34+
output = [
35+
"type=image",
36+
]
37+
platforms = [
38+
"linux/arm64",
39+
"linux/amd64",
40+
]
41+
}
42+
43+
target "docker-metadata-action" {
44+
tags = []
45+
}
46+
47+
48+
target "api-layer" {
49+
context = "./api-layer"
50+
dockerfile = "./api-layer/Dockerfile"
51+
target = "api-layer-release"
52+
inherits = [
53+
"_common",
54+
"docker-metadata-action",
55+
]
56+
tags = get_tag(target.docker-metadata-action.tags, "${target.api-layer.name}")
57+
}
58+
59+
target "api-layer-debug" {
60+
context = "./api-layer"
61+
dockerfile = "./api-layer/Dockerfile"
62+
target = "api-layer-debug"
63+
inherits = [
64+
"_common",
65+
"docker-metadata-action",
66+
]
67+
tags = get_tag(target.docker-metadata-action.tags, "${target.api-layer-debug.name}")
68+
}
69+
70+
target "mce" {
71+
context = "./metrics_computation_engine"
72+
dockerfile = "./metrics_computation_engine/Dockerfile"
73+
target = "mce-release"
74+
inherits = [
75+
"_common",
76+
"docker-metadata-action",
77+
]
78+
tags = get_tag(target.docker-metadata-action.tags, "${target.mce.name}")
79+
}
80+
81+
target "mce-debug" {
82+
context = "./metrics_computation_engine"
83+
dockerfile = "./metrics_computation_engine/Dockerfile"
84+
target = "mce-debug"
85+
inherits = [
86+
"_common",
87+
"docker-metadata-action",
88+
]
89+
tags = get_tag(target.docker-metadata-action.tags, "${target.mce-debug.name}")
90+
}

0 commit comments

Comments
 (0)