From 5e9237a89b0f7583ba8576dc758b137811e3f29d Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Wed, 20 Nov 2024 13:05:31 +0100 Subject: [PATCH 01/10] refactor: added Docker image for visualization plugins Signed-off-by: Esteve Fernandez --- docker/docker-bake.hcl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index dcf79ffc115..b5cf9575c7d 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -9,6 +9,7 @@ group "default" { "universe-planning-control", "universe-vehicle-system-devel", "universe-vehicle-system", + "universe-visualization", "universe-devel", "universe" ] @@ -24,6 +25,7 @@ target "docker-metadata-action-universe-planning-control-devel" {} target "docker-metadata-action-universe-planning-control" {} target "docker-metadata-action-universe-vehicle-system-devel" {} target "docker-metadata-action-universe-vehicle-system" {} +target "docker-metadata-action-universe-visualization" {} target "docker-metadata-action-universe-devel" {} target "docker-metadata-action-universe" {} @@ -81,6 +83,12 @@ target "universe-vehicle-system" { target = "universe-vehicle-system" } +target "universe-visualization" { + inherits = ["docker-metadata-action-universe-visualization"] + dockerfile = "docker/Dockerfile" + target = "universe-visualization" +} + target "universe-devel" { inherits = ["docker-metadata-action-universe-devel"] dockerfile = "docker/Dockerfile" From e65c5815f922383ab4cac8f981284ee3c1adb64f Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Mon, 16 Dec 2024 16:02:43 +0100 Subject: [PATCH 02/10] added visualization section Signed-off-by: Esteve Fernandez --- docker/Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 8857e43bc9e..e21baee2b81 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -35,6 +35,18 @@ RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ > /rosdep-universe-common-depend-packages.txt \ && cat /rosdep-universe-common-depend-packages.txt +FROM rosdep-depend AS rosdep-universe-visualization-depend +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO + +COPY src/universe/autoware.universe/visualization /autoware/src/universe/autoware.universe/visualization +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ + > /rosdep-universe-visualization-depend-packages.txt \ + && cat /rosdep-universe-visualization-depend-packages.txt +RUN /autoware/resolve_rosdep_keys.sh /autoware/src ${ROS_DISTRO} \ + > /rosdep-universe-visualization-exec-depend-packages.txt \ + && cat /rosdep-universe-visualization-exec-depend-packages.txt + FROM rosdep-depend AS rosdep-universe-sensing-perception-depend SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO From 58dfb1a218f286989ea193d0d04954c9ecfea70e Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Mon, 16 Dec 2024 16:04:51 +0100 Subject: [PATCH 03/10] update README.md Signed-off-by: Esteve Fernandez --- docker/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/README.md b/docker/README.md index 7128e578a39..32a88d709a5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -135,6 +135,10 @@ This stage is an Autoware Universe Sensing/Perception runtime container. It only This stage installs the CUDA runtime environment and copies the binaries built in the `universe-sensing-perception-devel-cuda` stage. +### `universe-visualization` + +This stage is a Autoware Universe Visualization runtime container. It only includes the dependencies given by `/rosdep-universe-visualization-exec-depend-packages.txt` and the binaries built in the `universe-visualization-devel` stage. + ### `universe-localization-mapping-devel` This stage installs the dependency packages based on `/rosdep-universe-localization-mapping-depend-packages.txt` and builds the packages under the following directories of `autoware.repos`: From 7f5d3e8e8e5324130a8216d6247396771f1bbc6c Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Mon, 16 Dec 2024 16:05:11 +0100 Subject: [PATCH 04/10] update README.md Signed-off-by: Esteve Fernandez --- docker/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/README.md b/docker/README.md index 32a88d709a5..c5bdf3a7fca 100644 --- a/docker/README.md +++ b/docker/README.md @@ -191,6 +191,7 @@ Then it builds the remaining packages of `autoware.repos`: - `universe/autoware.universe/launch` - `universe/autoware.universe/simulator` - `universe/autoware.universe/tools` +- `universe/autoware.universe/visualization` - `vehicle` This stage provides an all-in-one development container to Autoware developers. By running the host's source code with volume mounting, it allows for easy building and debugging of Autoware. From 18f6dd7ac84d6c9c9c9fc3e5b066264247059d5e Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Mon, 13 Jan 2025 16:54:10 +0100 Subject: [PATCH 05/10] added stages for visualization image Signed-off-by: Esteve Fernandez --- docker/Dockerfile | 53 ++++++++++++++++++++++++++++++++++++++++++ docker/build.sh | 16 +++++++++++++ docker/docker-bake.hcl | 2 ++ 3 files changed, 71 insertions(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index e21baee2b81..1cef85dbd9d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -326,6 +326,33 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-common-devel AS universe-visualization-devel +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ENV CCACHE_DIR="/root/.ccache" + +# Install rosdep dependencies +COPY --from=rosdep-universe-visualization-depend /rosdep-universe-visualization-depend-packages.txt /tmp/rosdep-universe-visualization-depend-packages.txt +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + apt-get update \ + && cat /tmp/rosdep-universe-visualization-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ + && /autoware/cleanup_apt.sh + +# hadolint ignore=SC1091 +RUN --mount=type=cache,target=${CCACHE_DIR} \ + --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/vehicle,target=/autoware/src/universe/autoware.universe/vehicle \ + --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/system,target=/autoware/src/universe/autoware.universe/system \ + --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/map/autoware_map_height_fitter,target=/autoware/src/universe/autoware.universe/map/autoware_map_height_fitter \ + --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/localization/autoware_pose2twist,target=/autoware/src/universe/autoware.universe/localization/autoware_pose2twist \ + source /opt/ros/"$ROS_DISTRO"/setup.bash \ + && source /opt/autoware/setup.bash \ + && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM universe-common-devel AS universe-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -506,6 +533,32 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +# hadolint ignore=DL3006 +FROM $AUTOWARE_BASE_IMAGE AS universe-visualization +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG LIB_DIR + +# Set up runtime environment +COPY --from=rosdep-universe-visualization-depend /rosdep-universe-visualization-exec-depend-packages.txt /tmp/rosdep-universe-visualization-exec-depend-packages.txt +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get update \ + && cat /tmp/rosdep-universe-visualization-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ + && /autoware/cleanup_system.sh $LIB_DIR $ROS_DISTRO + +COPY --from=universe-visualization-devel /opt/autoware /opt/autoware + +# Copy bash aliases +COPY docker/etc/.bash_aliases /root/.bash_aliases +RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + # hadolint ignore=DL3006 FROM $AUTOWARE_BASE_IMAGE AS universe SHELL ["/bin/bash", "-o", "pipefail", "-c"] diff --git a/docker/build.sh b/docker/build.sh index d0d8b8976eb..6afc7e90053 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -134,6 +134,22 @@ build_images() { --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" \ + --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 "universe-devel.tags=ghcr.io/autowarefoundation/autoware:universe-devel" \ + --set "universe-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-devel-cuda" \ + --set "universe.tags=ghcr.io/autowarefoundation/autoware:universe" \ + --set "universe-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-cuda" \ + --set "universe-visualization.tags=ghcr.io/autowarefoundation/autoware:universe-visualization" \ + "universe-visualization" 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" \ diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index b5cf9575c7d..82c6887b4c1 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -9,6 +9,7 @@ group "default" { "universe-planning-control", "universe-vehicle-system-devel", "universe-vehicle-system", + "universe-visualization-devel", "universe-visualization", "universe-devel", "universe" @@ -25,6 +26,7 @@ target "docker-metadata-action-universe-planning-control-devel" {} target "docker-metadata-action-universe-planning-control" {} target "docker-metadata-action-universe-vehicle-system-devel" {} target "docker-metadata-action-universe-vehicle-system" {} +target "docker-metadata-action-universe-visualization-devel" {} target "docker-metadata-action-universe-visualization" {} target "docker-metadata-action-universe-devel" {} target "docker-metadata-action-universe" {} From 399861559c59cdf53dc1aa02827b1c069b7f5247 Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Mon, 13 Jan 2025 16:59:29 +0100 Subject: [PATCH 06/10] fix dependency generation Signed-off-by: Esteve Fernandez --- docker/Dockerfile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1cef85dbd9d..02e5e7c4aad 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -342,10 +342,7 @@ RUN --mount=type=ssh \ # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ - --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/vehicle,target=/autoware/src/universe/autoware.universe/vehicle \ - --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/system,target=/autoware/src/universe/autoware.universe/system \ - --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/map/autoware_map_height_fitter,target=/autoware/src/universe/autoware.universe/map/autoware_map_height_fitter \ - --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/localization/autoware_pose2twist,target=/autoware/src/universe/autoware.universe/localization/autoware_pose2twist \ + --mount=type=bind,from=rosdep-universe-visualization-depend,source=/autoware/src/universe/autoware.universe/visualization,target=/autoware/src/universe/autoware.universe/visualization \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ && /autoware/build_and_clean.sh ${CCACHE_DIR} /opt/autoware From 5e057cb608daf4b86ef9b0a35dba5224aedc28e8 Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Tue, 14 Jan 2025 13:42:07 +0100 Subject: [PATCH 07/10] added target option Signed-off-by: Esteve Fernandez --- docker/build.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index 6afc7e90053..4ce2c264702 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -11,6 +11,7 @@ print_help() { echo " --no-cuda Disable CUDA support" echo " --platform Specify the platform (default: current platform)" echo " --devel-only Build devel image only" + echo " --target Specify the target image" echo "" echo "Note: The --platform option should be one of 'linux/amd64' or 'linux/arm64'." } @@ -36,6 +37,10 @@ parse_arguments() { --devel-only) option_devel_only=true ;; + --target) + option_target="$2" + shift + ;; *) echo "Unknown option: $1" print_help @@ -58,10 +63,14 @@ set_cuda_options() { # Set build options set_build_options() { - if [ "$option_devel_only" = "true" ]; then - target="universe-devel" + if [ -n "$option_target" ]; then + target="$option_target" else - target="universe" + if [ "$option_devel_only" = "true" ]; then + target="universe-devel" + else + target="universe" + fi fi } From 31a6c992a08053f64f2426ee918140d4b8c4bf80 Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Tue, 14 Jan 2025 13:44:18 +0100 Subject: [PATCH 08/10] remove suffix and explicit visualization build Signed-off-by: Esteve Fernandez --- docker/build.sh | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index 4ce2c264702..aa2c8ae8bab 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -11,7 +11,7 @@ print_help() { echo " --no-cuda Disable CUDA support" echo " --platform Specify the platform (default: current platform)" echo " --devel-only Build devel image only" - echo " --target Specify the target image" + echo " --target Specify the target image (default: universe or universe-devel if --devel-only is set)" echo "" echo "Note: The --platform option should be one of 'linux/amd64' or 'linux/arm64'." } @@ -65,6 +65,7 @@ set_cuda_options() { set_build_options() { if [ -n "$option_target" ]; then target="$option_target" + image_name_suffix="" else if [ "$option_devel_only" = "true" ]; then target="universe-devel" @@ -158,21 +159,6 @@ build_images() { --set "universe.tags=ghcr.io/autowarefoundation/autoware:universe" \ --set "universe-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-cuda" \ --set "universe-visualization.tags=ghcr.io/autowarefoundation/autoware:universe-visualization" \ - "universe-visualization" - 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 "universe-devel.tags=ghcr.io/autowarefoundation/autoware:universe-devel" \ - --set "universe-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-devel-cuda" \ - --set "universe.tags=ghcr.io/autowarefoundation/autoware:universe" \ - --set "universe-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-cuda" \ "$target$image_name_suffix" set +x } From 15b5eeddab34863ab79de53641184a4efc47b02e Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Wed, 15 Jan 2025 12:57:05 +0100 Subject: [PATCH 09/10] added tags for all targets Signed-off-by: Esteve Fernandez --- docker/build.sh | 15 +++++++++++++-- docker/docker-bake.hcl | 6 ++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index aa2c8ae8bab..4d239417638 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -154,11 +154,22 @@ build_images() { --set "*.args.AUTOWARE_BASE_CUDA_IMAGE=$autoware_base_cuda_image" \ --set "*.args.SETUP_ARGS=$setup_args" \ --set "*.args.LIB_DIR=$lib_dir" \ + --set "universe-sensing-perception-devel.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception-devel" \ + --set "universe-sensing-perception.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception" \ + --set "universe-localization-mapping-devel.tags=ghcr.io/autowarefoundation/autoware:universe-localization-mapping-devel" \ + --set "universe-localization-mapping.tags=ghcr.io/autowarefoundation/autoware:universe-localization-mapping" \ + --set "universe-planning-control-devel.tags=ghcr.io/autowarefoundation/autoware:universe-planning-control-devel" \ + --set "universe-planning-control.tags=ghcr.io/autowarefoundation/autoware:universe-planning-control" \ + --set "universe-vehicle-system-devel.tags=ghcr.io/autowarefoundation/autoware:universe-vehicle-system-devel" \ + --set "universe-vehicle-system.tags=ghcr.io/autowarefoundation/autoware:universe-vehicle-system" \ + --set "universe-visualization-devel.tags=ghcr.io/autowarefoundation/autoware:universe-visualization-devel" \ + --set "universe-visualization.tags=ghcr.io/autowarefoundation/autoware:universe-visualization" \ --set "universe-devel.tags=ghcr.io/autowarefoundation/autoware:universe-devel" \ - --set "universe-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-devel-cuda" \ --set "universe.tags=ghcr.io/autowarefoundation/autoware:universe" \ + --set "universe-sensing-perception-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception-devel-cuda" \ + --set "universe-sensing-perception-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-sensing-perception-cuda" \ + --set "universe-devel-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-devel-cuda" \ --set "universe-cuda.tags=ghcr.io/autowarefoundation/autoware:universe-cuda" \ - --set "universe-visualization.tags=ghcr.io/autowarefoundation/autoware:universe-visualization" \ "$target$image_name_suffix" set +x } diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index 82c6887b4c1..600b47108be 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -85,6 +85,12 @@ target "universe-vehicle-system" { target = "universe-vehicle-system" } +target "universe-visualization-devel" { + inherits = ["docker-metadata-action-universe-visualization-devel"] + dockerfile = "docker/Dockerfile" + target = "universe-visualization-devel" +} + target "universe-visualization" { inherits = ["docker-metadata-action-universe-visualization"] dockerfile = "docker/Dockerfile" From 8e53d688cafa2b4b21f4eb43731e0e84e9c9288e Mon Sep 17 00:00:00 2001 From: Esteve Fernandez Date: Wed, 15 Jan 2025 13:23:02 +0100 Subject: [PATCH 10/10] added COPY statement for universe-visualization-devel Signed-off-by: Esteve Fernandez --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 02e5e7c4aad..21a570ab9a3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -368,6 +368,7 @@ COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware COPY --from=universe-localization-mapping-devel /opt/autoware /opt/autoware COPY --from=universe-planning-control-devel /opt/autoware /opt/autoware COPY --from=universe-vehicle-system-devel /opt/autoware /opt/autoware +COPY --from=universe-visualization-devel /opt/autoware /opt/autoware # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/launcher,target=/autoware/src/launcher \