-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdocker-bake.hcl
More file actions
95 lines (87 loc) · 2.5 KB
/
docker-bake.hcl
File metadata and controls
95 lines (87 loc) · 2.5 KB
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
85
86
87
88
89
90
91
92
93
94
95
// Copyright (c) 2026, iRobot ROS
// All rights reserved.
//
// This source code is licensed under the BSD 3-Clause License found in the
// LICENSE file in the root directory of this source tree.
// =================================================================================================
//
// This file defines the build configuration for the Docker images using Docker Bake.
// Docker Bake is a tool that allows building multiple Docker images in parallel,
// based on a declarative configuration file.
//
// For more information on Docker Bake, see the official documentation:
// https://docs.docker.com/build/bake/reference/
//
// == Usage ==
//
// To build the images, you can use the `docker buildx bake` command.
//
// Build the default target (amd64 for all distros):
// docker buildx bake
//
// Build all targets (amd64 and arm64):
// docker buildx bake all
//
// Build a specific target:
// docker buildx bake amd64
//
// =================================================================================================
// Defines the prefix for the Docker image tags.
variable "TAG_PREFIX" {
default = "ros2-benchmark-container"
}
variable "DISTRO" {
default = "jazzy"
}
// Defines a common base target with shared configuration.
target "_common" {
dockerfile = "Dockerfile"
labels = {
"org.opencontainers.image.version" = "1.0.0"
"org.opencontainers.image.description" = "Container for running ROS2 / rmw benchmark utilities."
"org.opencontainers.image.title" = "${TAG_PREFIX}"
"org.opencontainers.image.created" = "${timestamp()}"
}
}
// Defines the build target for the amd64 architecture.
target "amd64" {
inherits = ["_common"]
matrix = {
distro = [DISTRO]
}
target = "ros2-benchmark-container"
name = "ros2-benchmark-container-${distro}-amd64"
tags = [
"${TAG_PREFIX}:${distro}-amd64"
]
args = {
ROS_DISTRO = distro
BASE_IMAGE = "ros:${distro}"
}
platforms = ["${BAKE_LOCAL_PLATFORM}"]
}
// Defines the build target for the arm64 architecture.
target "arm64" {
inherits = ["_common"]
matrix = {
distro = [DISTRO]
}
target = "ros2-benchmark-container"
name = "ros2-benchmark-container-${distro}-arm64"
tags = [
"${TAG_PREFIX}:${distro}-arm64"
]
args = {
ROS_DISTRO = distro
BASE_IMAGE = "ros:${distro}"
}
platforms = ["linux/arm64/v8"]
}
// Defines a build group that includes both amd64 and arm64 targets.
group "all" {
targets = ["amd64", "arm64"]
}
// Defines the default build group.
group "default" {
targets = ["amd64"]
}