Skip to content

Commit e04dbc1

Browse files
committed
Add bakefile
1 parent 4b86b25 commit e04dbc1

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

.docker/docker-bake.hcl

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#
2+
# By default this bakefile builds:
3+
# - the "ci" and "robot" stages for both arm64 and amd64, and
4+
# - the "desktop" and "desktop-nvidia" stages for amd64
5+
# for ROS "rolling"
6+
#
7+
# To build all default targets and load to _this_ machine:
8+
#
9+
# docker buildx bake --load
10+
#
11+
# To override this behavior, create a file "docker-bake.override.hcl" in
12+
# this directory containing the following snippets (for example):
13+
#
14+
# To build both "ci" and "robot" for _only_ amd64:
15+
#
16+
# target "ci" {
17+
# platforms = ["linux/amd64"]
18+
# }
19+
#
20+
# To set the ROS disto:
21+
#
22+
# variable "BLUE_ROS_DISTRO" { default = "jazzy" }
23+
#
24+
# OR set the environment variable BLUE_ROS_DISTRO
25+
#
26+
27+
28+
variable "BLUE_ROS_DISTRO" { default = "rolling" }
29+
variable "BLUE_GITHUB_REPO" { default = "robotic-decision-making-lab/blue" }
30+
31+
group "default" {
32+
targets = ["ci", "robot", "desktop", "desktop-nvidia"]
33+
}
34+
35+
target "ci" {
36+
dockerfile = ".docker/Dockerfile"
37+
target = "ci"
38+
context = ".."
39+
args = {
40+
ROS_DISTRO = "${BLUE_ROS_DISTRO}"
41+
}
42+
tags = [
43+
"ghcr.io/${BLUE_GITHUB_REPO}:${BLUE_ROS_DISTRO}-ci"
44+
]
45+
labels = {
46+
"org.opencontainers.image.source" = "https://github.com/${BLUE_GITHUB_REPO}"
47+
}
48+
cache_from =[
49+
"ghcr.io/${BLUE_GITHUB_REPO}:${BLUE_ROS_DISTRO}-ci",
50+
"ghcr.io/${BLUE_GITHUB_REPO}:${BLUE_ROS_DISTRO}-robot",
51+
"ghcr.io/${BLUE_GITHUB_REPO}:${BLUE_ROS_DISTRO}-desktop",
52+
"ghcr.io/${BLUE_GITHUB_REPO}:${BLUE_ROS_DISTRO}-desktop-nvidia",
53+
"type=local,dest=.docker-cache"
54+
]
55+
cache_to = [
56+
"type=local,dest=.docker-cache"
57+
]
58+
platforms = ["linux/amd64", "linux/arm64"]
59+
}
60+
61+
target "mavros" {
62+
inherits = [ "ci" ]
63+
target = "mavros"
64+
tags = [
65+
]
66+
cache_to = [
67+
"type=local,dest=.docker-cache"
68+
]
69+
}
70+
71+
target "robot" {
72+
inherits = [ "ci" ]
73+
target = "robot"
74+
tags = [
75+
"ghcr.io/${BLUE_GITHUB_REPO}:${BLUE_ROS_DISTRO}-robot"
76+
]
77+
cache_to = [
78+
"type=local,dest=.docker-cache"
79+
]
80+
}
81+
82+
target "desktop" {
83+
inherits = [ "ci" ]
84+
target = "desktop"
85+
tags = [
86+
"ghcr.io/${BLUE_GITHUB_REPO}:${BLUE_ROS_DISTRO}-desktop"
87+
]
88+
cache_to = [
89+
"type=local,dest=.docker-cache"
90+
]
91+
platforms = ["linux/amd64"]
92+
}
93+
94+
target "desktop-nvidia" {
95+
inherits = [ "desktop" ]
96+
target = "desktop-nvidia"
97+
tags = [
98+
"ghcr.io/${BLUE_GITHUB_REPO}:${BLUE_ROS_DISTRO}-desktop-nvidia"
99+
]
100+
cache_to = [
101+
"type=local,dest=.docker-cache"
102+
]
103+
}

0 commit comments

Comments
 (0)