Skip to content

Commit

Permalink
fix(docker): update build script with respect to multi-container design
Browse files Browse the repository at this point in the history
Signed-off-by: amadeuszsz <[email protected]>
  • Loading branch information
amadeuszsz committed Dec 16, 2024
1 parent d99cfde commit 6a7a691
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 5 deletions.
46 changes: 41 additions & 5 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,24 +118,60 @@ build_images() {
echo "Building images for platform: $platform"
echo "ROS distro: $rosdistro"
echo "Base image: $base_image"
echo "Base Autoware image: $autoware_base_image"
echo "Base Autoware CUDA image: $autoware_base_cuda_image"
echo "Setup args: $setup_args"
echo "Lib dir: $lib_dir"
echo "Image name suffix: $image_name_suffix"
echo "Targets: ${targets[*]}"

set -x
docker buildx bake --load --progress=plain -f "$SCRIPT_DIR/docker-bake.hcl" \
docker buildx bake --load --progress=plain -f "$SCRIPT_DIR/docker-bake-base.hcl" \
--set "*.context=$WORKSPACE_ROOT" \
--set "*.ssh=default" \
--set "*.platform=$platform" \
--set "*.args.ROS_DISTRO=$rosdistro" \
--set "*.args.BASE_IMAGE=$base_image" \
--set "*.args.AUTOWARE_BASE_IMAGE=$autoware_base_image" \
--set "*.args.AUTOWARE_BASE_CUDA_IMAGE=$autoware_base_cuda_image" \
--set "*.args.SETUP_ARGS=$setup_args" \
--set "*.args.LIB_DIR=$lib_dir" \
--set "base.tags=ghcr.io/autowarefoundation/autoware:base" \
--set "universe-devel.tags=ghcr.io/autowarefoundation/autoware:universe-devel$image_name_suffix" \
--set "universe.tags=ghcr.io/autowarefoundation/autoware:universe$image_name_suffix" \
"${targets[@]}"
--set "base.tags=ghcr.io/autowarefoundation/autoware-base:latest" \
--set "base-cuda.tags=ghcr.io/autowarefoundation/autoware-base:cuda-latest"

docker buildx bake --load --progress=plain -f "$SCRIPT_DIR/docker-bake.hcl" -f "$SCRIPT_DIR/docker-bake-cuda.hcl" \
--set "*.context=$WORKSPACE_ROOT" \
--set "*.ssh=default" \
--set "*.platform=$platform" \
--set "*.args.ROS_DISTRO=$rosdistro" \
--set "*.args.BASE_IMAGE=$base_image" \
--set "*.args.AUTOWARE_BASE_IMAGE=$autoware_base_image" \
--set "*.args.AUTOWARE_BASE_CUDA_IMAGE=$autoware_base_cuda_image" \
--set "*.args.SETUP_ARGS=$setup_args" \
--set "*.args.LIB_DIR=$lib_dir" \
--set "rosdep-depend.tags=ghcr.io/autowarefoundation/autoware:rosdep-depend" \
--set "rosdep-universe-sensing-perception-depend.tags=ghcr.io/autowarefoundation/autoware:rosdep-universe-sensing-perception-depend" \
--set "rosdep-universe-localization-mapping-depend.tags=ghcr.io/autowarefoundation/autoware:rosdep-universe-localization-mapping-depend" \
--set "rosdep-universe-planning-control-depend.tags=ghcr.io/autowarefoundation/autoware:rosdep-universe-planning-control-depend" \
--set "rosdep-universe-vehicle-system-depend.tags=ghcr.io/autowarefoundation/autoware:rosdep-universe-vehicle-system-depend" \
--set "rosdep-universe-depend.tags=ghcr.io/autowarefoundation/autoware:rosdep-universe-depend" \
--set "core-devel.tags=ghcr.io/autowarefoundation/autoware:core-devel" \
--set "universe-common-devel.tags=ghcr.io/autowarefoundation/autoware:universe-common-devel" \
--set "universe-common-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-common-devel-cuda" \
--set "universe-sensing-perception-devel.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception-devel" \
--set "universe-sensing-perception-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception-devel-cuda" \
--set "universe-localization-mapping-devel.tags=ghcr.io/autowarefoundation/autoware:universe-localization-mapping-devel" \
--set "universe-planning-control-devel.tags=ghcr.io/autowarefoundation/autoware:universe-planning-control-devel" \
--set "universe-vehicle-system-devel.tags=ghcr.io/autowarefoundation/autoware:universe-vehicle-system-devel" \
--set "universe-devel.tags=ghcr.io/autowarefoundation/autoware:universe-devel" \
--set "universe-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-devel-cuda" \
--set "universe-sensing-perception.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception" \
--set "universe-sensing-perception-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception-cuda" \
--set "universe-localization-mapping.tags=ghcr.io/autowarefoundation/autoware:universe-localization-mapping" \
--set "universe-planning-control.tags=ghcr.io/autowarefoundation/autoware:universe-planning-control" \
--set "universe-vehicle-system.tags=ghcr.io/autowarefoundation/autoware:universe-vehicle-system" \
--set "universe.tags=ghcr.io/autowarefoundation/autoware:universe" \
--set "universe-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-cuda"
set +x
}

Expand Down
8 changes: 8 additions & 0 deletions docker/docker-bake-cuda.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
group "default" {
targets = [
"universe-common-devel-cuda",
"universe-sensing-perception-devel-cuda",
"universe-sensing-perception-cuda",
"universe-devel-cuda",
Expand All @@ -8,11 +9,18 @@ group "default" {
}

// For docker/metadata-action
target "docker-metadata-action-universe-common-devel-cuda" {}
target "docker-metadata-action-universe-sensing-perception-devel-cuda" {}
target "docker-metadata-action-universe-sensing-perception-cuda" {}
target "docker-metadata-action-universe-devel-cuda" {}
target "docker-metadata-action-universe-cuda" {}

target "universe-common-devel-cuda" {
inherits = ["docker-metadata-action-universe-common-devel-cuda"]
dockerfile = "docker/Dockerfile"
target = "universe-common-devel-cuda"
}

target "universe-sensing-perception-devel-cuda" {
inherits = ["docker-metadata-action-universe-sensing-perception-devel-cuda"]
dockerfile = "docker/Dockerfile"
Expand Down
55 changes: 55 additions & 0 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
group "default" {
targets = [
"rosdep-depend",
"rosdep-universe-depend",
"rosdep-universe-sensing-perception-depend",
"rosdep-universe-vehicle-system-depend",
"rosdep-universe-planning-control-depend",
"rosdep-universe-localization-mapping-depend",
"core-devel",
"universe-common-devel",
"universe-sensing-perception-devel",
"universe-sensing-perception",
"universe-localization-mapping-devel",
Expand All @@ -15,7 +22,14 @@ group "default" {
}

// For docker/metadata-action
target "docker-metadata-action-rosdep-depend" {}
target "docker-metadata-action-rosdep-universe-depend" {}
target "docker-metadata-action-rosdep-universe-sensing-perception-depend" {}
target "docker-metadata-action-rosdep-universe-vehicle-system-depend" {}
target "docker-metadata-action-rosdep-universe-planning-control-depend" {}
target "docker-metadata-action-rosdep-universe-localization-mapping-depend" {}
target "docker-metadata-action-core-devel" {}
target "docker-metadata-action-universe-common-devel" {}
target "docker-metadata-action-universe-sensing-perception-devel" {}
target "docker-metadata-action-universe-sensing-perception" {}
target "docker-metadata-action-universe-localization-mapping-devel" {}
Expand All @@ -27,12 +41,53 @@ target "docker-metadata-action-universe-vehicle-system" {}
target "docker-metadata-action-universe-devel" {}
target "docker-metadata-action-universe" {}

target "rosdep-depend" {
inherits = ["docker-metadata-action-rosdep-depend"]
dockerfile = "docker/Dockerfile"
target = "rosdep-depend"
}

target "rosdep-universe-depend" {
inherits = ["docker-metadata-action-rosdep-universe-depend"]
dockerfile = "docker/Dockerfile"
target = "rosdep-universe-depend"
}

target "rosdep-universe-sensing-perception-depend" {
inherits = ["docker-metadata-action-rosdep-universe-sensing-perception-depend"]
dockerfile = "docker/Dockerfile"
target = "rosdep-universe-sensing-perception-depend"
}

target "rosdep-universe-vehicle-system-depend" {
inherits = ["docker-metadata-action-rosdep-universe-vehicle-system-depend"]
dockerfile = "docker/Dockerfile"
target = "rosdep-universe-vehicle-system-depend"
}

target "rosdep-universe-planning-control-depend" {
inherits = ["docker-metadata-action-rosdep-universe-planning-control-depend"]
dockerfile = "docker/Dockerfile"
target = "rosdep-universe-planning-control-depend"
}

target "rosdep-universe-localization-mapping-depend" {
inherits = ["docker-metadata-action-rosdep-universe-localization-mapping-depend"]
dockerfile = "docker/Dockerfile"
target = "rosdep-universe-localization-mapping-depend"
}
target "core-devel" {
inherits = ["docker-metadata-action-core-devel"]
dockerfile = "docker/Dockerfile"
target = "core-devel"
}

target "universe-common-devel" {
inherits = ["docker-metadata-action-universe-common-devel"]
dockerfile = "docker/Dockerfile"
target = "universe-common-devel"
}

target "universe-sensing-perception-devel" {
inherits = ["docker-metadata-action-universe-sensing-perception-devel"]
dockerfile = "docker/Dockerfile"
Expand Down

0 comments on commit 6a7a691

Please sign in to comment.