From 6a7a6913197e1c1acc885c095be53cc42f1bfd2c Mon Sep 17 00:00:00 2001 From: amadeuszsz Date: Tue, 17 Dec 2024 00:25:18 +0900 Subject: [PATCH 1/5] fix(docker): update build script with respect to multi-container design Signed-off-by: amadeuszsz --- docker/build.sh | 46 +++++++++++++++++++++++++++---- docker/docker-bake-cuda.hcl | 8 ++++++ docker/docker-bake.hcl | 55 +++++++++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 5 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index b962137b79c..9e5dd668817 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -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 } diff --git a/docker/docker-bake-cuda.hcl b/docker/docker-bake-cuda.hcl index 87aa27df879..1f4c182f714 100644 --- a/docker/docker-bake-cuda.hcl +++ b/docker/docker-bake-cuda.hcl @@ -1,5 +1,6 @@ group "default" { targets = [ + "universe-common-devel-cuda", "universe-sensing-perception-devel-cuda", "universe-sensing-perception-cuda", "universe-devel-cuda", @@ -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" diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index dcf79ffc115..1a1e06bfc75 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -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", @@ -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" {} @@ -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" From 0f1df2d5c43b4fb3b6c400cfa7ac96dc3fb4aa4d Mon Sep 17 00:00:00 2001 From: amadeuszsz Date: Thu, 19 Dec 2024 11:24:38 +0900 Subject: [PATCH 2/5] feat(docker): add target image (not working) Signed-off-by: amadeuszsz --- docker/build.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index 9e5dd668817..ca19769d7bd 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -59,9 +59,9 @@ set_cuda_options() { # Set build options set_build_options() { if [ "$option_devel_only" = "true" ]; then - targets=("universe-devel") + target="universe-devel" else - targets=() + target="universe" fi } @@ -123,7 +123,7 @@ build_images() { echo "Setup args: $setup_args" echo "Lib dir: $lib_dir" echo "Image name suffix: $image_name_suffix" - echo "Targets: ${targets[*]}" + echo "Target: $target" set -x docker buildx bake --load --progress=plain -f "$SCRIPT_DIR/docker-bake-base.hcl" \ @@ -137,7 +137,8 @@ build_images() { --set "*.args.SETUP_ARGS=$setup_args" \ --set "*.args.LIB_DIR=$lib_dir" \ --set "base.tags=ghcr.io/autowarefoundation/autoware-base:latest" \ - --set "base-cuda.tags=ghcr.io/autowarefoundation/autoware-base:cuda-latest" + --set "base-cuda.tags=ghcr.io/autowarefoundation/autoware-base:cuda-latest" \ + base$image_name_suffix docker buildx bake --load --progress=plain -f "$SCRIPT_DIR/docker-bake.hcl" -f "$SCRIPT_DIR/docker-bake-cuda.hcl" \ --set "*.context=$WORKSPACE_ROOT" \ @@ -171,7 +172,8 @@ build_images() { --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 "universe-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-cuda" \ + $target$image_name_suffix set +x } From b6985852a3ac1888788246a1e29be04035d95903 Mon Sep 17 00:00:00 2001 From: amadeuszsz Date: Thu, 19 Dec 2024 11:26:05 +0900 Subject: [PATCH 3/5] fix(docker): build all stages & remove unused args Signed-off-by: amadeuszsz --- docker/build.sh | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index ca19769d7bd..a5de2f4bffc 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -8,9 +8,7 @@ print_help() { echo "Options:" echo " --help Display this help message" echo " -h Display this help message" - echo " --no-cuda Disable CUDA support" echo " --platform Specify the platform (default: current platform)" - echo " --devel-only Build devel image only" echo "" echo "Note: The --platform option should be one of 'linux/amd64' or 'linux/arm64'." } @@ -26,16 +24,10 @@ parse_arguments() { print_help exit 1 ;; - --no-cuda) - option_no_cuda=true - ;; --platform) option_platform="$2" shift ;; - --devel-only) - option_devel_only=true - ;; *) echo "Unknown option: $1" print_help @@ -46,25 +38,6 @@ parse_arguments() { done } -# Set CUDA options -set_cuda_options() { - if [ "$option_no_cuda" = "true" ]; then - setup_args="--no-nvidia" - image_name_suffix="" - else - image_name_suffix="-cuda" - fi -} - -# Set build options -set_build_options() { - if [ "$option_devel_only" = "true" ]; then - target="universe-devel" - else - target="universe" - fi -} - # Set platform set_platform() { if [ -n "$option_platform" ]; then @@ -120,10 +93,7 @@ build_images() { 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 "Target: $target" set -x docker buildx bake --load --progress=plain -f "$SCRIPT_DIR/docker-bake-base.hcl" \ @@ -134,11 +104,9 @@ build_images() { --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:latest" \ - --set "base-cuda.tags=ghcr.io/autowarefoundation/autoware-base:cuda-latest" \ - base$image_name_suffix + --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" \ @@ -148,7 +116,6 @@ build_images() { --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" \ @@ -172,8 +139,7 @@ build_images() { --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" \ - $target$image_name_suffix + --set "universe-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-cuda" set +x } @@ -184,8 +150,6 @@ remove_dangling_images() { # Main script execution parse_arguments "$@" -set_cuda_options -set_build_options set_platform set_arch_lib_dir load_env From 49285a6090dce8ca29500514e8da7ec5213cf1ba Mon Sep 17 00:00:00 2001 From: amadeuszsz Date: Thu, 19 Dec 2024 21:57:57 +0900 Subject: [PATCH 4/5] fix(docker): revert hcl files Signed-off-by: amadeuszsz --- docker/docker-bake-cuda.hcl | 8 ------ docker/docker-bake.hcl | 55 ------------------------------------- 2 files changed, 63 deletions(-) diff --git a/docker/docker-bake-cuda.hcl b/docker/docker-bake-cuda.hcl index 1f4c182f714..87aa27df879 100644 --- a/docker/docker-bake-cuda.hcl +++ b/docker/docker-bake-cuda.hcl @@ -1,6 +1,5 @@ group "default" { targets = [ - "universe-common-devel-cuda", "universe-sensing-perception-devel-cuda", "universe-sensing-perception-cuda", "universe-devel-cuda", @@ -9,18 +8,11 @@ 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" diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index 1a1e06bfc75..dcf79ffc115 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -1,13 +1,6 @@ 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", @@ -22,14 +15,7 @@ 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" {} @@ -41,53 +27,12 @@ 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" From 4f8246dd5fcafcb6da21e3e898540ad3aebe05c3 Mon Sep 17 00:00:00 2001 From: amadeuszsz Date: Fri, 20 Dec 2024 13:06:17 +0900 Subject: [PATCH 5/5] fix(docker): revert args & use target Signed-off-by: amadeuszsz --- docker/build.sh | 61 +++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index a5de2f4bffc..d0d8b8976eb 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -8,7 +8,9 @@ print_help() { echo "Options:" echo " --help Display this help message" echo " -h Display this help message" + echo " --no-cuda Disable CUDA support" echo " --platform Specify the platform (default: current platform)" + echo " --devel-only Build devel image only" echo "" echo "Note: The --platform option should be one of 'linux/amd64' or 'linux/arm64'." } @@ -24,10 +26,16 @@ parse_arguments() { print_help exit 1 ;; + --no-cuda) + option_no_cuda=true + ;; --platform) option_platform="$2" shift ;; + --devel-only) + option_devel_only=true + ;; *) echo "Unknown option: $1" print_help @@ -38,6 +46,25 @@ parse_arguments() { done } +# Set CUDA options +set_cuda_options() { + if [ "$option_no_cuda" = "true" ]; then + setup_args="--no-nvidia" + image_name_suffix="" + else + image_name_suffix="-cuda" + fi +} + +# Set build options +set_build_options() { + if [ "$option_devel_only" = "true" ]; then + target="universe-devel" + else + target="universe" + fi +} + # Set platform set_platform() { if [ -n "$option_platform" ]; then @@ -91,9 +118,10 @@ 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 "Target: $target" set -x docker buildx bake --load --progress=plain -f "$SCRIPT_DIR/docker-bake-base.hcl" \ @@ -102,12 +130,10 @@ build_images() { --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: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" \ @@ -116,30 +142,13 @@ build_images() { --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 "universe-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-cuda" \ + "$target$image_name_suffix" set +x } @@ -150,6 +159,8 @@ remove_dangling_images() { # Main script execution parse_arguments "$@" +set_cuda_options +set_build_options set_platform set_arch_lib_dir load_env