From 10e53116d6b094a5f11d2097f13ceb5aec918e4a Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 16:33:19 +0900 Subject: [PATCH 01/20] add cuda-devel stage Signed-off-by: Yutaka Kondo --- docker/Dockerfile | 48 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 82e2ccaf9e0..17969acab0c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,7 +4,6 @@ ARG BASE_IMAGE FROM $BASE_IMAGE AS base SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO -ARG SETUP_ARGS # Install apt packages and add GitHub to known hosts for private repositories RUN rm -f /etc/apt/apt.conf.d/docker-clean \ @@ -25,7 +24,7 @@ WORKDIR /autoware # Set up base environment RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module base ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./setup-dev-env.sh -y --module base --no-nvidia --no-cuda-drivers --runtime openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && rm -rf "$HOME"/.cache \ && echo "source /opt/ros/${ROS_DISTRO}/setup.bash" > /etc/bash.bashrc @@ -193,13 +192,12 @@ RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ FROM base AS core-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO -ARG SETUP_ARGS ENV CCACHE_DIR="/root/.ccache" # Set up development environment and tools RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers openadkit \ + ./setup-dev-env.sh -y --module all --no-nvidia --no-cuda-drivers openadkit \ && ./setup-dev-env.sh -y --module dev-tools openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && rm -rf "$HOME"/.cache @@ -292,6 +290,48 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-sensing-perception-devel AS universe-sensing-perception-cuda-devel +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ENV CCACHE_DIR="/root/.ccache" + +# Set up CUDA development environment +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ + && ./setup-dev-env.sh -y --module dev-tools openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache + +# hadolint ignore=SC1091 +RUN --mount=type=cache,target=${CCACHE_DIR} \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack,target=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_shape_estimation,target=/autoware/src/universe/autoware.universe/perception/autoware_shape_estimation \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_classifier,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_classifier \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_yolox,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_yolox \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_classifier,target=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_classifier \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector,target=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/sensing/cuda_utils,target=/autoware/src/universe/autoware.universe/sensing/cuda_utils \ + # TODO(youtalk): Remove --mount option when https://github.com/autowarefoundation/autoware.universe/pull/9099 is merged + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/common/tensorrt_common,target=/autoware/src/universe/autoware.universe/common/tensorrt_common \ + source /opt/ros/"$ROS_DISTRO"/setup.bash \ + && source /opt/autoware/setup.bash \ + && du -sh ${CCACHE_DIR} && ccache -s \ + && colcon build --cmake-args \ + " -Wno-dev" \ + " --no-warn-unused-cli" \ + --merge-install \ + --install-base /opt/autoware \ + --mixin release compile-commands ccache \ + && du -sh ${CCACHE_DIR} && ccache -s \ + && rm -rf /autoware/build + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM universe-common-devel AS universe-localization-mapping-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO From d056ff4b54f34da63c93d5ddedf4a7d361274296 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 16:39:25 +0900 Subject: [PATCH 02/20] remove setup_args Signed-off-by: Yutaka Kondo --- docker/Dockerfile | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 17969acab0c..011b246177b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -479,14 +479,13 @@ FROM base AS universe-sensing-perception SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS # Set up runtime environment and artifacts COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-exec-depend-packages.txt /tmp/rosdep-universe-sensing-perception-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 ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadkit \ + ./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-sensing-perception-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -513,14 +512,13 @@ FROM base AS universe-localization-mapping SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS # Set up runtime environment and artifacts COPY --from=rosdep-universe-localization-mapping-depend /rosdep-universe-localization-mapping-exec-depend-packages.txt /tmp/rosdep-universe-localization-mapping-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 ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./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-localization-mapping-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -547,14 +545,13 @@ FROM base AS universe-planning-control SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS # Set up runtime environment and artifacts COPY --from=rosdep-universe-planning-control-depend /rosdep-universe-planning-control-exec-depend-packages.txt /tmp/rosdep-universe-planning-control-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 ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./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-planning-control-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -581,14 +578,13 @@ FROM base AS universe-vehicle-system SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS # Set up runtime environment and artifacts COPY --from=rosdep-universe-vehicle-system-depend /rosdep-universe-vehicle-system-exec-depend-packages.txt /tmp/rosdep-universe-vehicle-system-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 ${SETUP_ARGS} --no-cuda-drivers --runtime openadkit \ + ./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-vehicle-system-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ @@ -615,14 +611,13 @@ FROM base AS universe SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -ARG SETUP_ARGS # Set up runtime environment and artifacts COPY --from=rosdep-universe-depend /rosdep-exec-depend-packages.txt /tmp/rosdep-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 ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadkit \ + ./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-exec-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ From 75b1eb928b638683e808da08ba1e9919548c29fb Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 17:17:18 +0900 Subject: [PATCH 03/20] update comments Signed-off-by: Yutaka Kondo --- docker/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 011b246177b..cb01b9ebc74 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -480,7 +480,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-sensing-perception-depend /rosdep-universe-sensing-perception-exec-depend-packages.txt /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ @@ -513,7 +513,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-localization-mapping-depend /rosdep-universe-localization-mapping-exec-depend-packages.txt /tmp/rosdep-universe-localization-mapping-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ @@ -546,7 +546,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-planning-control-depend /rosdep-universe-planning-control-exec-depend-packages.txt /tmp/rosdep-universe-planning-control-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ @@ -579,7 +579,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-vehicle-system-depend /rosdep-universe-vehicle-system-exec-depend-packages.txt /tmp/rosdep-universe-vehicle-system-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ @@ -612,7 +612,7 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR -# Set up runtime environment and artifacts +# Set up runtime environment COPY --from=rosdep-universe-depend /rosdep-exec-depend-packages.txt /tmp/rosdep-exec-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ From 657ea700c9303b2a0e2e4f70186b90e144281d32 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 18:00:43 +0900 Subject: [PATCH 04/20] update dockerfile Signed-off-by: Yutaka Kondo --- docker/Dockerfile | 78 ++++++- docker/Dockerfile.svg | 507 ++++++++++++++++++++++++------------------ 2 files changed, 360 insertions(+), 225 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index cb01b9ebc74..0e756234b48 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -299,13 +299,12 @@ ENV CCACHE_DIR="/root/.ccache" RUN --mount=type=ssh \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ - && ./setup-dev-env.sh -y --module dev-tools openadkit \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && rm -rf "$HOME"/.cache # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ - --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack,target=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend, source=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack,target=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion \ @@ -316,7 +315,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector,target=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/sensing/cuda_utils,target=/autoware/src/universe/autoware.universe/sensing/cuda_utils \ # TODO(youtalk): Remove --mount option when https://github.com/autowarefoundation/autoware.universe/pull/9099 is merged - --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/common/tensorrt_common,target=/autoware/src/universe/autoware.universe/common/tensorrt_common \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/common/tensorrt_common,target=/autoware/src/universe/autoware.universe/common/tensorrt_common \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ && du -sh ${CCACHE_DIR} && ccache -s \ @@ -475,6 +474,21 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-devel AS universe-cuda-devel +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Set up CUDA development environment +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --no-cuda-drivers openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache + +COPY --from=universe-sensing-perception-cuda-devel /opt/autoware /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM base AS universe-sensing-perception SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -494,8 +508,7 @@ RUN --mount=type=ssh \ && find / -name "*.o" -type f -delete \ && find / -name "*.h" -type f -delete \ && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + && rm -rf /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* @@ -508,6 +521,32 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-sensing-perception AS universe-sensing-perception-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG LIB_DIR + +# Set up CUDA runtime environment and artifacts +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --download-artifacts --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache \ + && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ + && find / -name "*.o" -type f -delete \ + && find / -name "*.h" -type f -delete \ + && find / -name "*.hpp" -type f -delete \ + && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ + /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ + /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + +COPY --from=universe-sensing-perception-cuda-devel /opt/autoware /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM base AS universe-localization-mapping SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -626,8 +665,7 @@ RUN --mount=type=ssh \ && find / -name "*.o" -type f -delete \ && find / -name "*.h" -type f -delete \ && find / -name "*.hpp" -type f -delete \ - && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ - /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + && rm -rf /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* @@ -639,3 +677,29 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] + +FROM universe AS universe-cuda +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG LIB_DIR + +# Set up CUDA runtime environment and artifacts +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + ./setup-dev-env.sh -y --module all --download-artifacts --no-cuda-drivers --runtime openadkit \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && rm -rf "$HOME"/.cache \ + && find /usr/lib/$LIB_DIR-linux-gnu -name "*.a" -type f -delete \ + && find / -name "*.o" -type f -delete \ + && find / -name "*.h" -type f -delete \ + && find / -name "*.hpp" -type f -delete \ + && rm -rf /autoware/ansible /autoware/ansible-galaxy-requirements.yaml /autoware/setup-dev-env.sh /autoware/*.env \ + /root/.local/pipx /opt/ros/"$ROS_DISTRO"/include /etc/apt/sources.list.d/cuda*.list \ + /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ + /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* + +COPY --from=universe-cuda-devel /opt/autoware /opt/autoware + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] diff --git a/docker/Dockerfile.svg b/docker/Dockerfile.svg index a8d5d4e1d37..1da71481c51 100644 --- a/docker/Dockerfile.svg +++ b/docker/Dockerfile.svg @@ -1,414 +1,485 @@ - - - + + G - + cluster_legend - + key -FROM ...  -COPY --from=...  -RUN --mount=(.*)from=...  +FROM ...  +COPY --from=...  +RUN --mount=(.*)from=...  key2 -  -  -  +  +  +  key:e->key2:w - - + + key:e->key2:w - - + + key:e->key2:w - - + + external_image_0 - -$BASE_IMAGE + +$BASE_IMAGE stage_0 - -base + +base external_image_0->stage_0 - - + + stage_1 - -rosdep-depend + +rosdep-depend external_image_0->stage_1 - - + + stage_7 - -core-devel + +core-devel stage_0->stage_7 - - + + - + -stage_14 - -universe-sensing-perception +stage_16 + +universe-sensing-perception - + -stage_0->stage_14 - - - +stage_0->stage_16 + + - + -stage_15 - -universe-localization-mapping +stage_18 + +universe-localization-mapping - + -stage_0->stage_15 - - +stage_0->stage_18 + + - + -stage_16 - -universe-planning-control +stage_19 + +universe-planning-control - + -stage_0->stage_16 - - - - +stage_0->stage_19 + + - + -stage_17 - -universe-vehicle-system +stage_20 + +universe-vehicle-system - + -stage_0->stage_17 - +stage_0->stage_20 + + - + -stage_18 - -universe +stage_21 + +universe - + -stage_0->stage_18 - - +stage_0->stage_21 + + + + + stage_1->stage_7 - - + + stage_2 - -rosdep-universe-sensing-perception-depend + +rosdep-universe-sensing-perception-depend stage_1->stage_2 - - + + stage_3 - -rosdep-universe-localization-mapping-depend + +rosdep-universe-localization-mapping-depend stage_1->stage_3 - - + + + stage_4 - -rosdep-universe-planning-control-depend + +rosdep-universe-planning-control-depend stage_1->stage_4 - - - + + stage_5 - -rosdep-universe-vehicle-system-depend + +rosdep-universe-vehicle-system-depend stage_1->stage_5 - - + + stage_6 - -rosdep-universe-depend + +rosdep-universe-depend stage_1->stage_6 - - - + + stage_8 - -universe-common-devel + +universe-common-devel stage_1->stage_8 - - + + - + stage_7->stage_8 - - + + - - -stage_2->stage_14 - - + + +stage_17 + +universe-sensing-perception-cuda + + + +stage_16->stage_17 + + + + + +stage_22 + +universe-cuda + + + +stage_21->stage_22 + + + + + +stage_2->stage_16 + + stage_9 - -universe-sensing-perception-devel + +universe-sensing-perception-devel stage_2->stage_9 - - - - - -stage_3->stage_15 - - + + stage_10 - -universe-localization-mapping-devel + +universe-sensing-perception-cuda-devel - - -stage_3->stage_10 - - + + +stage_2->stage_10 + + + - - -stage_4->stage_16 - - + + +stage_3->stage_18 + + stage_11 - -universe-planning-control-devel + +universe-localization-mapping-devel - - -stage_4->stage_11 - - + + +stage_3->stage_11 + + - - -stage_5->stage_17 - - - + + +stage_4->stage_19 + + stage_12 - -universe-vehicle-system-devel + +universe-planning-control-devel - - -stage_5->stage_12 - - + + +stage_4->stage_12 + + - - -stage_6->stage_18 - - + + +stage_5->stage_20 + + stage_13 - -universe-devel + +universe-vehicle-system-devel - - -stage_6->stage_13 - - + + +stage_5->stage_13 + + - - -stage_8->stage_9 - - + + +stage_6->stage_21 + - + + +stage_14 + +universe-devel + + + +stage_6->stage_14 + + + + -stage_8->stage_10 - - +stage_8->stage_9 + + stage_8->stage_11 - - + + stage_8->stage_12 - - + + stage_8->stage_13 - - - - - -stage_9->stage_14 - - + + - + -stage_9->stage_13 - - +stage_8->stage_14 + + - + -stage_10->stage_15 - - +stage_9->stage_16 + + - + + +stage_9->stage_10 + + + + -stage_10->stage_13 - - +stage_9->stage_14 + + - - -stage_11->stage_16 - - + + +stage_15 + +universe-cuda-devel - + -stage_11->stage_13 - - +stage_10->stage_15 + + + + + +stage_10->stage_17 + + - + -stage_12->stage_17 - - +stage_11->stage_18 + + - + -stage_12->stage_13 - - +stage_11->stage_14 + + + + + +stage_12->stage_19 + + - + -stage_13->stage_18 - - +stage_12->stage_14 + + + + + +stage_13->stage_20 + + + + + +stage_13->stage_14 + + + + + +stage_14->stage_21 + + + + + +stage_14->stage_15 + + + + + +stage_15->stage_22 + + From b1cf7021ef132cafeb22b794050dd00b580d3e5e Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 18:12:55 +0900 Subject: [PATCH 05/20] update workflow Signed-off-by: Yutaka Kondo --- .github/actions/docker-build/action.yaml | 25 ++++++++--------------- .github/workflows/health-check-arm64.yaml | 24 +++------------------- .github/workflows/health-check.yaml | 22 +++----------------- 3 files changed, 15 insertions(+), 56 deletions(-) diff --git a/.github/actions/docker-build/action.yaml b/.github/actions/docker-build/action.yaml index 1fec7b76005..936d8596dde 100644 --- a/.github/actions/docker-build/action.yaml +++ b/.github/actions/docker-build/action.yaml @@ -2,9 +2,6 @@ name: docker-build description: "" inputs: - name: - description: "" - required: true platform: description: "" required: true @@ -39,48 +36,44 @@ runs: - name: Cache ccache uses: actions/cache@v4 - if: ${{ inputs.name == 'no-cuda' && github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' }} id: cache-ccache with: path: | root-ccache - key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }} + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} restore-keys: | - ccache-${{ inputs.platform }}-${{ inputs.name }}- ccache-${{ inputs.platform }}- - name: Cache apt-get uses: actions/cache@v4 - if: ${{ inputs.name == 'no-cuda' && github.ref == 'refs/heads/main' }} + if: ${{ && github.ref == 'refs/heads/main' }} id: cache-apt-get with: path: | var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }} + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} restore-keys: | - apt-get-${{ inputs.platform }}-${{ inputs.name }}- apt-get-${{ inputs.platform }}- - name: Restore ccache uses: actions/cache/restore@v4 - if: ${{ inputs.name != 'no-cuda' || github.ref != 'refs/heads/main' }} + if: ${{ github.ref != 'refs/heads/main' }} with: path: | root-ccache - key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }} + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} restore-keys: | - ccache-${{ inputs.platform }}-${{ inputs.name }}- ccache-${{ inputs.platform }}- - name: Restore apt-get uses: actions/cache/restore@v4 - if: ${{ inputs.name != 'no-cuda' || github.ref != 'refs/heads/main' }} + if: ${{ github.ref != 'refs/heads/main' }} with: path: | var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }} + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} restore-keys: | - apt-get-${{ inputs.platform }}-${{ inputs.name }}- apt-get-${{ inputs.platform }}- - name: Inject cache into docker @@ -106,4 +99,4 @@ runs: context: . push: false build-args: ${{ inputs.build-args }} - cache-from: type=registry,ref=${{ github.repository }}-buildcache:${{ inputs.name }}-${{ inputs.platform }}-${{ inputs.cache-tag-suffix }} + cache-from: type=registry,ref=${{ github.repository }}-buildcache:${{ inputs.platform }}-${{ inputs.cache-tag-suffix }} diff --git a/.github/workflows/health-check-arm64.yaml b/.github/workflows/health-check-arm64.yaml index 9ef1c8f5b61..8f71d173a52 100644 --- a/.github/workflows/health-check-arm64.yaml +++ b/.github/workflows/health-check-arm64.yaml @@ -12,22 +12,6 @@ jobs: docker-build: needs: load-env runs-on: buildjet-16vcpu-ubuntu-2204-arm - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - setup-args: --no-nvidia - - name: cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 steps: # https://github.com/actions/checkout/issues/211 - name: Change permission of workspace @@ -45,14 +29,12 @@ jobs: - name: Build 'Autoware' uses: ./.github/actions/docker-build with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: arm64 cache-tag-suffix: main build-args: | ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - SETUP_ARGS=${{ matrix.setup-args }} - LIB_DIR=${{ matrix.lib_dir }} + BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + LIB_DIR=aarch64 dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space diff --git a/.github/workflows/health-check.yaml b/.github/workflows/health-check.yaml index 3da9f52de8c..885342bdc6a 100644 --- a/.github/workflows/health-check.yaml +++ b/.github/workflows/health-check.yaml @@ -29,20 +29,6 @@ jobs: runs-on: buildjet-16vcpu-ubuntu-2204 strategy: fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - setup-args: --no-nvidia - - name: cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 steps: - name: Check out repository uses: actions/checkout@v4 @@ -55,14 +41,12 @@ jobs: - name: Build 'Autoware' uses: ./.github/actions/docker-build with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: amd64 cache-tag-suffix: main build-args: | ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - SETUP_ARGS=${{ matrix.setup-args }} - LIB_DIR=${{ matrix.lib_dir }} + BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + LIB_DIR=x86_64 dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space From f0570f322cf5680dbdece951179f64c3fbed277f Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 19:50:16 +0900 Subject: [PATCH 06/20] change run Signed-off-by: Yutaka Kondo --- .github/workflows/health-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/health-check.yaml b/.github/workflows/health-check.yaml index 885342bdc6a..472a48ec391 100644 --- a/.github/workflows/health-check.yaml +++ b/.github/workflows/health-check.yaml @@ -26,7 +26,7 @@ jobs: docker-build: needs: load-env - runs-on: buildjet-16vcpu-ubuntu-2204 + runs-on: ubuntu-22.04 strategy: fail-fast: false steps: From 5cb4ec10e1febbf561be8b1e13f336e6ee2ab117 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 19:51:50 +0900 Subject: [PATCH 07/20] fix Signed-off-by: Yutaka Kondo --- .github/actions/docker-build/action.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/docker-build/action.yaml b/.github/actions/docker-build/action.yaml index 936d8596dde..e6926233a72 100644 --- a/.github/actions/docker-build/action.yaml +++ b/.github/actions/docker-build/action.yaml @@ -47,7 +47,7 @@ runs: - name: Cache apt-get uses: actions/cache@v4 - if: ${{ && github.ref == 'refs/heads/main' }} + if: ${{ github.ref == 'refs/heads/main' }} id: cache-apt-get with: path: | From 0ca87c41edbceec245db90f690bac348d46bd57d Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 19:56:39 +0900 Subject: [PATCH 08/20] fix Signed-off-by: Yutaka Kondo --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 0e756234b48..25a2e155017 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -304,7 +304,7 @@ RUN --mount=type=ssh \ # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ - --mount=type=bind,from=rosdep-universe-sensing-perception-depend, source=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack,target=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack,target=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion \ From 9752940b2b091a8866d51017d973d67c36f24b99 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 20:03:15 +0900 Subject: [PATCH 09/20] use buildjet Signed-off-by: Yutaka Kondo --- .github/workflows/health-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/health-check.yaml b/.github/workflows/health-check.yaml index 472a48ec391..885342bdc6a 100644 --- a/.github/workflows/health-check.yaml +++ b/.github/workflows/health-check.yaml @@ -26,7 +26,7 @@ jobs: docker-build: needs: load-env - runs-on: ubuntu-22.04 + runs-on: buildjet-16vcpu-ubuntu-2204 strategy: fail-fast: false steps: From dbb1dfa1dced3199019cc5b5b9c0edbcfbd2219c Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Fri, 18 Oct 2024 21:36:13 +0900 Subject: [PATCH 10/20] update docker-build-and-push Signed-off-by: Yutaka Kondo --- .../actions/docker-build-and-push/action.yaml | 60 ++++++++----------- .../docker-build-and-push-arm64.yaml | 35 +++-------- .github/workflows/docker-build-and-push.yaml | 35 +++-------- 3 files changed, 40 insertions(+), 90 deletions(-) diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 7e57b3f0afd..739518a740f 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -2,9 +2,6 @@ name: docker-build-and-push description: "" inputs: - name: - description: "" - required: true platform: description: "" required: true @@ -14,9 +11,6 @@ inputs: build-args: description: "" required: false - tag-suffix: - description: "" - required: false dockerhub-token: description: "" required: true @@ -45,9 +39,8 @@ runs: with: path: | root-ccache - key: ccache-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/*.cpp') }} + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} restore-keys: | - ccache-${{ inputs.platform }}-${{ inputs.name }}- ccache-${{ inputs.platform }}- - name: Restore apt-get @@ -55,9 +48,8 @@ runs: with: path: | var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ inputs.name }}-${{ hashFiles('src/**/package.xml') }} + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} restore-keys: | - apt-get-${{ inputs.platform }}-${{ inputs.name }}- apt-get-${{ inputs.platform }}- - name: Inject cache into docker @@ -81,8 +73,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=base${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=base${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=base-${{ inputs.platform }} + type=raw,value=base-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-base flavor: | latest=false @@ -93,8 +85,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=core-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=core-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=core-devel-${{ inputs.platform }} + type=raw,value=core-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-core-devel flavor: | latest=false @@ -105,8 +97,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-sensing-perception-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-sensing-perception-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-sensing-perception-devel flavor: | latest=false @@ -117,8 +109,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-sensing-perception${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-sensing-perception${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-sensing-perception flavor: | latest=false @@ -129,8 +121,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-localization-mapping-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-localization-mapping-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-devel-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-localization-mapping-devel flavor: | latest=false @@ -141,8 +133,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-localization-mapping${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-localization-mapping${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-${{ inputs.platform }} + type=raw,value=universe-localization-mapping-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-localization-mapping flavor: | latest=false @@ -153,8 +145,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-planning-control-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-planning-control-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-planning-control-devel-${{ inputs.platform }} + type=raw,value=universe-planning-control-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-planning-control-devel flavor: | latest=false @@ -165,8 +157,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-planning-control${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-planning-control${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-planning-control-${{ inputs.platform }} + type=raw,value=universe-planning-control-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-planning-control flavor: | latest=false @@ -177,8 +169,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-vehicle-system-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-vehicle-system-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-devel-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-vehicle-system-devel flavor: | latest=false @@ -189,8 +181,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-vehicle-system${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-vehicle-system${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-${{ inputs.platform }} + type=raw,value=universe-vehicle-system-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-vehicle-system flavor: | latest=false @@ -201,8 +193,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe-devel${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe-devel${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-devel-${{ inputs.platform }} + type=raw,value=universe-devel-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe-devel flavor: | latest=false @@ -213,8 +205,8 @@ runs: with: images: ${{ github.repository_owner }}/${{ inputs.bake-target }} tags: | - type=raw,value=universe${{ inputs.tag-suffix }}-${{ inputs.platform }} - type=raw,value=universe${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }}-${{ inputs.platform }} + type=raw,value=universe-${{ inputs.platform }} + type=raw,value=universe-${{ steps.date.outputs.date }}-${{ inputs.platform }} bake-target: docker-metadata-action-universe flavor: | latest=auto diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index 5448188c096..3253ee9c9dc 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -14,24 +14,6 @@ jobs: docker-build-and-push: needs: load-env runs-on: buildjet-16vcpu-ubuntu-2204-arm - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - setup-args: --no-nvidia - tag-suffix: "" - - name: cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - tag-suffix: -cuda steps: - name: Check if PR author is the specific user id: author-check @@ -74,19 +56,16 @@ jobs: (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: arm64 bake-target: autoware build-args: | - *.platform=linux/${{ matrix.platform }} + *.platform=linux/arm64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - *.args.SETUP_ARGS=${{ matrix.setup-args }} - *.args.LIB_DIR=${{ matrix.lib_dir }} - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }} - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }},mode=max - tag-suffix: ${{ matrix.tag-suffix }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=aarch64 + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }} + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-main + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 69bb1cd60ce..17c3624a090 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -14,24 +14,6 @@ jobs: docker-build-and-push: needs: load-env runs-on: buildjet-16vcpu-ubuntu-2204 - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - setup-args: --no-nvidia - tag-suffix: "" - - name: cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - tag-suffix: -cuda steps: - name: Check if PR author is the specific user id: author-check @@ -74,19 +56,16 @@ jobs: (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} + platform: amd64 bake-target: autoware build-args: | - *.platform=linux/${{ matrix.platform }} + *.platform=linux/amd64 *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - *.args.BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - *.args.SETUP_ARGS=${{ matrix.setup-args }} - *.args.LIB_DIR=${{ matrix.lib_dir }} - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }} - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.head_ref }},mode=max - tag-suffix: ${{ matrix.tag-suffix }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=x86_64 + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }} + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-main + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space From d3b6743072218cf86ccc964b6b46eb3c471c0c4e Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Mon, 21 Oct 2024 06:59:02 +0900 Subject: [PATCH 11/20] remove mode=max Signed-off-by: Yutaka Kondo --- .github/workflows/docker-build-and-push-arm64.yaml | 2 +- .github/workflows/docker-build-and-push.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index 3253ee9c9dc..3a134438fa8 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -65,7 +65,7 @@ jobs: *.args.LIB_DIR=aarch64 *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }} *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }},mode=max + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }} dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 17c3624a090..8d0a07ff21b 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -65,7 +65,7 @@ jobs: *.args.LIB_DIR=x86_64 *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }} *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }},mode=max + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }} dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space From 500c595775959ec45928ef3f2bed20596a81374e Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 22 Oct 2024 06:51:55 +0900 Subject: [PATCH 12/20] rename cuda stages Signed-off-by: Yutaka Kondo --- docker/Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 25a2e155017..22eb121f70d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -290,7 +290,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM universe-sensing-perception-devel AS universe-sensing-perception-cuda-devel +FROM universe-sensing-perception-devel AS universe-sensing-perception-devel-cuda SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" @@ -474,7 +474,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM universe-devel AS universe-cuda-devel +FROM universe-devel AS universe-devel-cuda SHELL ["/bin/bash", "-o", "pipefail", "-c"] # Set up CUDA development environment @@ -484,7 +484,7 @@ RUN --mount=type=ssh \ && pip uninstall -y ansible ansible-core \ && apt-get autoremove -y && rm -rf "$HOME"/.cache -COPY --from=universe-sensing-perception-cuda-devel /opt/autoware /opt/autoware +COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -542,7 +542,7 @@ RUN --mount=type=ssh \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* -COPY --from=universe-sensing-perception-cuda-devel /opt/autoware /opt/autoware +COPY --from=universe-sensing-perception-devel-cuda /opt/autoware /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] @@ -699,7 +699,7 @@ RUN --mount=type=ssh \ /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \ /usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm* -COPY --from=universe-cuda-devel /opt/autoware /opt/autoware +COPY --from=universe-devel-cuda /opt/autoware /opt/autoware ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] From 55d829be6b13d3acf6e394bca7e20a94d561b9da Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 22 Oct 2024 06:52:59 +0900 Subject: [PATCH 13/20] Revert "remove mode=max" This reverts commit d3b6743072218cf86ccc964b6b46eb3c471c0c4e. --- .github/workflows/docker-build-and-push-arm64.yaml | 2 +- .github/workflows/docker-build-and-push.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index 3a134438fa8..3253ee9c9dc 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -65,7 +65,7 @@ jobs: *.args.LIB_DIR=aarch64 *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }} *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }} + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 8d0a07ff21b..17c3624a090 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -65,7 +65,7 @@ jobs: *.args.LIB_DIR=x86_64 *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }} *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }} + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - name: Show disk space From c211b8546700078d80c2d78eced9b14a15b969de Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 22 Oct 2024 07:02:03 +0900 Subject: [PATCH 14/20] update cuda packages Signed-off-by: Yutaka Kondo --- docker/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 22eb121f70d..56c2b2b555f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -304,18 +304,18 @@ RUN --mount=type=ssh \ # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ + # TODO(youtalk): Move CUDA related packages into a dedicated directory --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack,target=/autoware/src/universe/autoware.universe/perception/autoware_bytetrack \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_apollo_instance_segmentation \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_centerpoint \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion,target=/autoware/src/universe/autoware.universe/perception/autoware_lidar_transfusion \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_shape_estimation,target=/autoware/src/universe/autoware.universe/perception/autoware_shape_estimation \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_classifier,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_classifier \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_common \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_yolox,target=/autoware/src/universe/autoware.universe/perception/autoware_tensorrt_yolox \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_classifier,target=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_classifier \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector,target=/autoware/src/universe/autoware.universe/perception/autoware_traffic_light_fine_detector \ --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/sensing/cuda_utils,target=/autoware/src/universe/autoware.universe/sensing/cuda_utils \ - # TODO(youtalk): Remove --mount option when https://github.com/autowarefoundation/autoware.universe/pull/9099 is merged - --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/common/tensorrt_common,target=/autoware/src/universe/autoware.universe/common/tensorrt_common \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ && du -sh ${CCACHE_DIR} && ccache -s \ From c34651ea77658d9c23e3ff91d90bd7c445da9d7a Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 22 Oct 2024 11:10:06 +0900 Subject: [PATCH 15/20] add cuda workflow Signed-off-by: Yutaka Kondo --- .../docker-build-and-push-cuda/action.yaml | 136 ++++++++++++++++++ .../docker-build-and-push-arm64.yaml | 21 ++- .github/workflows/docker-build-and-push.yaml | 21 ++- docker/docker-bake-cuda.hcl | 38 +++++ 4 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 .github/actions/docker-build-and-push-cuda/action.yaml create mode 100644 docker/docker-bake-cuda.hcl diff --git a/.github/actions/docker-build-and-push-cuda/action.yaml b/.github/actions/docker-build-and-push-cuda/action.yaml new file mode 100644 index 00000000000..d5452f38d65 --- /dev/null +++ b/.github/actions/docker-build-and-push-cuda/action.yaml @@ -0,0 +1,136 @@ +name: docker-build-and-push +description: "" + +inputs: + platform: + description: "" + required: true + bake-target: + description: "" + required: true + build-args: + description: "" + required: false + dockerhub-token: + description: "" + required: true + +runs: + using: composite + steps: + - name: Install jq and vcstool + run: | + sudo apt-get -y update + sudo apt-get -y install jq python3-pip + pip install --no-cache-dir vcstool + shell: bash + + - name: Run vcs import + run: | + mkdir src + vcs import src < autoware.repos + shell: bash + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Restore ccache + uses: actions/cache/restore@v4 + with: + path: | + root-ccache + key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} + restore-keys: | + ccache-${{ inputs.platform }}- + + - name: Restore apt-get + uses: actions/cache/restore@v4 + with: + path: | + var-cache-apt + key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} + restore-keys: | + apt-get-${{ inputs.platform }}- + + - name: Inject cache into docker + uses: reproducible-containers/buildkit-cache-dance@v3.1.2 + with: + cache-map: | + { + "root-ccache": "/root/.ccache", + "var-cache-apt": "/var/cache/apt" + } + skip-extraction: true + + - name: Get current date + id: date + run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT + shell: bash + + - name: Docker meta for autoware:universe-sensing-perception-devel-cuda + id: meta-universe-sensing-perception-devel-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-sensing-perception-devel-cuda-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-sensing-perception-devel-cuda + flavor: | + latest=false + + - name: Docker meta for autoware:universe-sensing-perception-cuda + id: meta-universe-sensing-perception-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-sensing-perception-cuda-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-sensing-perception-cuda + flavor: | + latest=false + + - name: Docker meta for autoware:universe-devel-cuda + id: meta-universe-devel-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-devel-cuda-${{ inputs.platform }} + type=raw,value=universe-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-devel-cuda + flavor: | + latest=false + + - name: Docker meta for autoware:universe-cuda + id: meta-universe-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-cuda-${{ inputs.platform }} + type=raw,value=universe-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-cuda + flavor: | + latest=auto + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ github.repository_owner }} + password: ${{ inputs.dockerhub-token }} + + - name: Build and Push to GitHub Container Registry + uses: docker/bake-action@v5 + with: + push: true + files: | + docker/docker-bake-cuda.hcl + ${{ steps.meta-universe-sensing-perception-devel-cuda.outputs.bake-file }} + ${{ steps.meta-universe-sensing-perception-cuda.outputs.bake-file }} + ${{ steps.meta-universe-devel-cuda.outputs.bake-file }} + ${{ steps.meta-universe-cuda.outputs.bake-file }} + provenance: false + set: | + ${{ inputs.build-args }} diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index 3253ee9c9dc..d9e2bbf050e 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -49,7 +49,7 @@ jobs: ansible/** docker/** - - name: Build 'Autoware' + - name: Build 'Autoware' without CUDA if: ${{ steps.author-check.outputs.author-found == 'true' || steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || @@ -68,6 +68,25 @@ jobs: *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build 'Autoware' with CUDA + if: ${{ steps.author-check.outputs.author-found == 'true' || + steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'push' && github.ref_type == 'tag') }} + uses: ./.github/actions/docker-build-and-push-cuda + with: + platform: arm64 + bake-target: autoware + build-args: | + *.platform=linux/arm64 + *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=aarch64 + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-cuda-${{ github.head_ref }} + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-cuda-main + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-cuda-${{ github.head_ref }},mode=max + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Show disk space run: | df -h diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 17c3624a090..0effd8ce742 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -49,7 +49,7 @@ jobs: ansible/** docker/** - - name: Build 'Autoware' + - name: Build 'Autoware' without CUDA if: ${{ steps.author-check.outputs.author-found == 'true' || steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || @@ -68,6 +68,25 @@ jobs: *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build 'Autoware' with CUDA + if: ${{ steps.author-check.outputs.author-found == 'true' || + steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'push' && github.ref_type == 'tag') }} + uses: ./.github/actions/docker-build-and-push-cuda + with: + platform: amd64 + bake-target: autoware + build-args: | + *.platform=linux/amd64 + *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=x86_64 + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-${{ github.head_ref }} + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-main + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-${{ github.head_ref }},mode=max + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Show disk space run: | df -h diff --git a/docker/docker-bake-cuda.hcl b/docker/docker-bake-cuda.hcl new file mode 100644 index 00000000000..87aa27df879 --- /dev/null +++ b/docker/docker-bake-cuda.hcl @@ -0,0 +1,38 @@ +group "default" { + targets = [ + "universe-sensing-perception-devel-cuda", + "universe-sensing-perception-cuda", + "universe-devel-cuda", + "universe-cuda" + ] +} + +// For docker/metadata-action +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-sensing-perception-devel-cuda" { + inherits = ["docker-metadata-action-universe-sensing-perception-devel-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-sensing-perception-devel-cuda" +} + +target "universe-sensing-perception-cuda" { + inherits = ["docker-metadata-action-universe-sensing-perception-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-sensing-perception-cuda" +} + +target "universe-devel-cuda" { + inherits = ["docker-metadata-action-universe-devel-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-devel-cuda" +} + +target "universe-cuda" { + inherits = ["docker-metadata-action-universe-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-cuda" +} From f8033db763aaf4790471c0a8fa9ddeeba25b30df Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 22 Oct 2024 11:16:23 +0900 Subject: [PATCH 16/20] divide jobs Signed-off-by: Yutaka Kondo --- .../docker-build-and-push-arm64.yaml | 17 +++++++++- .github/workflows/docker-build-and-push.yaml | 34 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index d9e2bbf050e..a6b1ed554c1 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -68,9 +68,24 @@ jobs: *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Show disk space + run: | + df -h + + docker-build-and-push-cuda: + needs: docker-build-and-push + runs-on: buildjet-16vcpu-ubuntu-2204-arm + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set git config + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Build 'Autoware' with CUDA if: ${{ steps.author-check.outputs.author-found == 'true' || - steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push-cuda diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 0effd8ce742..6cb43f9e77e 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -90,3 +90,37 @@ jobs: - name: Show disk space run: | df -h + + docker-build-and-push-cuda: + needs: docker-build-and-push + runs-on: buildjet-16vcpu-ubuntu-2204 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set git config + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Build 'Autoware' with CUDA + if: ${{ steps.author-check.outputs.author-found == 'true' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'push' && github.ref_type == 'tag') }} + uses: ./.github/actions/docker-build-and-push-cuda + with: + platform: amd64 + bake-target: autoware + build-args: | + *.platform=linux/amd64 + *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} + *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} + *.args.LIB_DIR=x86_64 + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-${{ github.head_ref }} + *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-main + *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-${{ github.head_ref }},mode=max + dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Show disk space + run: | + df -h From 03e5e138b6f3c9bccdded321d48ac9a4cfc25237 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 22 Oct 2024 11:50:00 +0900 Subject: [PATCH 17/20] fix Signed-off-by: Yutaka Kondo --- .github/workflows/docker-build-and-push.yaml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 6cb43f9e77e..843101d1f69 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -68,25 +68,6 @@ jobs: *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build 'Autoware' with CUDA - if: ${{ steps.author-check.outputs.author-found == 'true' || - steps.changed-files.outputs.any_changed == 'true' || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'push' && github.ref_type == 'tag') }} - uses: ./.github/actions/docker-build-and-push-cuda - with: - platform: amd64 - bake-target: autoware - build-args: | - *.platform=linux/amd64 - *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} - *.args.LIB_DIR=x86_64 - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-${{ github.head_ref }} - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-${{ github.head_ref }},mode=max - dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Show disk space run: | df -h From a12780a91b2f1f9dce91ba5b2d833643a97f2aab Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 22 Oct 2024 13:47:17 +0900 Subject: [PATCH 18/20] not divide jobs Signed-off-by: Yutaka Kondo --- .../workflows/docker-build-and-push-arm64.yaml | 17 +---------------- .github/workflows/docker-build-and-push.yaml | 17 +---------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index a6b1ed554c1..d9e2bbf050e 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -68,24 +68,9 @@ jobs: *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Show disk space - run: | - df -h - - docker-build-and-push-cuda: - needs: docker-build-and-push - runs-on: buildjet-16vcpu-ubuntu-2204-arm - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Set git config - uses: autowarefoundation/autoware-github-actions/set-git-config@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Build 'Autoware' with CUDA if: ${{ steps.author-check.outputs.author-found == 'true' || + steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push-cuda diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 843101d1f69..0effd8ce742 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -68,24 +68,9 @@ jobs: *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Show disk space - run: | - df -h - - docker-build-and-push-cuda: - needs: docker-build-and-push - runs-on: buildjet-16vcpu-ubuntu-2204 - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Set git config - uses: autowarefoundation/autoware-github-actions/set-git-config@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Build 'Autoware' with CUDA if: ${{ steps.author-check.outputs.author-found == 'true' || + steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_type == 'tag') }} uses: ./.github/actions/docker-build-and-push-cuda From a7d43fb72c225ef1b2bbce46904b3ef294d424d9 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 22 Oct 2024 15:07:21 +0900 Subject: [PATCH 19/20] remove redundant Signed-off-by: Yutaka Kondo --- .../actions/docker-build-and-push-cuda/action.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/actions/docker-build-and-push-cuda/action.yaml b/.github/actions/docker-build-and-push-cuda/action.yaml index d5452f38d65..35419e96d0d 100644 --- a/.github/actions/docker-build-and-push-cuda/action.yaml +++ b/.github/actions/docker-build-and-push-cuda/action.yaml @@ -18,19 +18,6 @@ inputs: runs: using: composite steps: - - name: Install jq and vcstool - run: | - sudo apt-get -y update - sudo apt-get -y install jq python3-pip - pip install --no-cache-dir vcstool - shell: bash - - - name: Run vcs import - run: | - mkdir src - vcs import src < autoware.repos - shell: bash - - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 From 17eb872731b87b34e694af908e791e65e42b52ce Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Tue, 22 Oct 2024 16:00:29 +0900 Subject: [PATCH 20/20] integrate Signed-off-by: Yutaka Kondo --- .../docker-build-and-push-cuda/action.yaml | 123 ------------------ .../actions/docker-build-and-push/action.yaml | 52 ++++++++ .../docker-build-and-push-arm64.yaml | 21 +-- .github/workflows/docker-build-and-push.yaml | 21 +-- docker/docker-bake-cuda.hcl | 38 ------ docker/docker-bake.hcl | 34 ++++- 6 files changed, 87 insertions(+), 202 deletions(-) delete mode 100644 .github/actions/docker-build-and-push-cuda/action.yaml delete mode 100644 docker/docker-bake-cuda.hcl diff --git a/.github/actions/docker-build-and-push-cuda/action.yaml b/.github/actions/docker-build-and-push-cuda/action.yaml deleted file mode 100644 index 35419e96d0d..00000000000 --- a/.github/actions/docker-build-and-push-cuda/action.yaml +++ /dev/null @@ -1,123 +0,0 @@ -name: docker-build-and-push -description: "" - -inputs: - platform: - description: "" - required: true - bake-target: - description: "" - required: true - build-args: - description: "" - required: false - dockerhub-token: - description: "" - required: true - -runs: - using: composite - steps: - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Restore ccache - uses: actions/cache/restore@v4 - with: - path: | - root-ccache - key: ccache-${{ inputs.platform }}-${{ hashFiles('src/**/*.cpp') }} - restore-keys: | - ccache-${{ inputs.platform }}- - - - name: Restore apt-get - uses: actions/cache/restore@v4 - with: - path: | - var-cache-apt - key: apt-get-${{ inputs.platform }}-${{ hashFiles('src/**/package.xml') }} - restore-keys: | - apt-get-${{ inputs.platform }}- - - - name: Inject cache into docker - uses: reproducible-containers/buildkit-cache-dance@v3.1.2 - with: - cache-map: | - { - "root-ccache": "/root/.ccache", - "var-cache-apt": "/var/cache/apt" - } - skip-extraction: true - - - name: Get current date - id: date - run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - shell: bash - - - name: Docker meta for autoware:universe-sensing-perception-devel-cuda - id: meta-universe-sensing-perception-devel-cuda - uses: docker/metadata-action@v5 - with: - images: ${{ github.repository_owner }}/${{ inputs.bake-target }} - tags: | - type=raw,value=universe-sensing-perception-devel-cuda-${{ inputs.platform }} - type=raw,value=universe-sensing-perception-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} - bake-target: docker-metadata-action-universe-sensing-perception-devel-cuda - flavor: | - latest=false - - - name: Docker meta for autoware:universe-sensing-perception-cuda - id: meta-universe-sensing-perception-cuda - uses: docker/metadata-action@v5 - with: - images: ${{ github.repository_owner }}/${{ inputs.bake-target }} - tags: | - type=raw,value=universe-sensing-perception-cuda-${{ inputs.platform }} - type=raw,value=universe-sensing-perception-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} - bake-target: docker-metadata-action-universe-sensing-perception-cuda - flavor: | - latest=false - - - name: Docker meta for autoware:universe-devel-cuda - id: meta-universe-devel-cuda - uses: docker/metadata-action@v5 - with: - images: ${{ github.repository_owner }}/${{ inputs.bake-target }} - tags: | - type=raw,value=universe-devel-cuda-${{ inputs.platform }} - type=raw,value=universe-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} - bake-target: docker-metadata-action-universe-devel-cuda - flavor: | - latest=false - - - name: Docker meta for autoware:universe-cuda - id: meta-universe-cuda - uses: docker/metadata-action@v5 - with: - images: ${{ github.repository_owner }}/${{ inputs.bake-target }} - tags: | - type=raw,value=universe-cuda-${{ inputs.platform }} - type=raw,value=universe-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} - bake-target: docker-metadata-action-universe-cuda - flavor: | - latest=auto - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ github.repository_owner }} - password: ${{ inputs.dockerhub-token }} - - - name: Build and Push to GitHub Container Registry - uses: docker/bake-action@v5 - with: - push: true - files: | - docker/docker-bake-cuda.hcl - ${{ steps.meta-universe-sensing-perception-devel-cuda.outputs.bake-file }} - ${{ steps.meta-universe-sensing-perception-cuda.outputs.bake-file }} - ${{ steps.meta-universe-devel-cuda.outputs.bake-file }} - ${{ steps.meta-universe-cuda.outputs.bake-file }} - provenance: false - set: | - ${{ inputs.build-args }} diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 739518a740f..1d802e999ce 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -103,6 +103,18 @@ runs: flavor: | latest=false + - name: Docker meta for autoware:universe-sensing-perception-devel-cuda + id: meta-universe-sensing-perception-devel-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-sensing-perception-devel-cuda-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-sensing-perception-devel-cuda + flavor: | + latest=false + - name: Docker meta for autoware:universe-sensing-perception id: meta-universe-sensing-perception uses: docker/metadata-action@v5 @@ -115,6 +127,18 @@ runs: flavor: | latest=false + - name: Docker meta for autoware:universe-sensing-perception-cuda + id: meta-universe-sensing-perception-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-sensing-perception-cuda-${{ inputs.platform }} + type=raw,value=universe-sensing-perception-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-sensing-perception-cuda + flavor: | + latest=false + - name: Docker meta for autoware:universe-localization-mapping-devel id: meta-universe-localization-mapping-devel uses: docker/metadata-action@v5 @@ -199,6 +223,18 @@ runs: flavor: | latest=false + - name: Docker meta for autoware:universe-devel-cuda + id: meta-universe-devel-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-devel-cuda-${{ inputs.platform }} + type=raw,value=universe-devel-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-devel-cuda + flavor: | + latest=false + - name: Docker meta for autoware:universe id: meta-universe uses: docker/metadata-action@v5 @@ -211,6 +247,18 @@ runs: flavor: | latest=auto + - name: Docker meta for autoware:universe-cuda + id: meta-universe-cuda + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-cuda-${{ inputs.platform }} + type=raw,value=universe-cuda-${{ steps.date.outputs.date }}-${{ inputs.platform }} + bake-target: docker-metadata-action-universe-cuda + flavor: | + latest=auto + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -226,7 +274,9 @@ runs: ${{ steps.meta-base.outputs.bake-file }} ${{ steps.meta-core-devel.outputs.bake-file }} ${{ steps.meta-universe-sensing-perception-devel.outputs.bake-file }} + ${{ steps.meta-universe-sensing-perception-devel-cuda.outputs.bake-file }} ${{ steps.meta-universe-sensing-perception.outputs.bake-file }} + ${{ steps.meta-universe-sensing-perception-cuda.outputs.bake-file }} ${{ steps.meta-universe-localization-mapping-devel.outputs.bake-file }} ${{ steps.meta-universe-localization-mapping.outputs.bake-file }} ${{ steps.meta-universe-planning-control-devel.outputs.bake-file }} @@ -234,7 +284,9 @@ runs: ${{ steps.meta-universe-vehicle-system-devel.outputs.bake-file }} ${{ steps.meta-universe-vehicle-system.outputs.bake-file }} ${{ steps.meta-universe-devel.outputs.bake-file }} + ${{ steps.meta-universe-devel-cuda.outputs.bake-file }} ${{ steps.meta-universe.outputs.bake-file }} + ${{ steps.meta-universe-cuda.outputs.bake-file }} provenance: false set: | ${{ inputs.build-args }} diff --git a/.github/workflows/docker-build-and-push-arm64.yaml b/.github/workflows/docker-build-and-push-arm64.yaml index d9e2bbf050e..3253ee9c9dc 100644 --- a/.github/workflows/docker-build-and-push-arm64.yaml +++ b/.github/workflows/docker-build-and-push-arm64.yaml @@ -49,7 +49,7 @@ jobs: ansible/** docker/** - - name: Build 'Autoware' without CUDA + - name: Build 'Autoware' if: ${{ steps.author-check.outputs.author-found == 'true' || steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || @@ -68,25 +68,6 @@ jobs: *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build 'Autoware' with CUDA - if: ${{ steps.author-check.outputs.author-found == 'true' || - steps.changed-files.outputs.any_changed == 'true' || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'push' && github.ref_type == 'tag') }} - uses: ./.github/actions/docker-build-and-push-cuda - with: - platform: arm64 - bake-target: autoware - build-args: | - *.platform=linux/arm64 - *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} - *.args.LIB_DIR=aarch64 - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-cuda-${{ github.head_ref }} - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:arm64-cuda-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:arm64-cuda-${{ github.head_ref }},mode=max - dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Show disk space run: | df -h diff --git a/.github/workflows/docker-build-and-push.yaml b/.github/workflows/docker-build-and-push.yaml index 0effd8ce742..17c3624a090 100644 --- a/.github/workflows/docker-build-and-push.yaml +++ b/.github/workflows/docker-build-and-push.yaml @@ -49,7 +49,7 @@ jobs: ansible/** docker/** - - name: Build 'Autoware' without CUDA + - name: Build 'Autoware' if: ${{ steps.author-check.outputs.author-found == 'true' || steps.changed-files.outputs.any_changed == 'true' || github.event_name == 'workflow_dispatch' || @@ -68,25 +68,6 @@ jobs: *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-${{ github.head_ref }},mode=max dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build 'Autoware' with CUDA - if: ${{ steps.author-check.outputs.author-found == 'true' || - steps.changed-files.outputs.any_changed == 'true' || - github.event_name == 'workflow_dispatch' || - (github.event_name == 'push' && github.ref_type == 'tag') }} - uses: ./.github/actions/docker-build-and-push-cuda - with: - platform: amd64 - bake-target: autoware - build-args: | - *.platform=linux/amd64 - *.args.ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - *.args.BASE_IMAGE=${{ needs.load-env.outputs.base_image }} - *.args.LIB_DIR=x86_64 - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-${{ github.head_ref }} - *.cache-from=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-main - *.cache-to=type=registry,ref=${{ github.repository }}-buildcache:amd64-cuda-${{ github.head_ref }},mode=max - dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Show disk space run: | df -h diff --git a/docker/docker-bake-cuda.hcl b/docker/docker-bake-cuda.hcl deleted file mode 100644 index 87aa27df879..00000000000 --- a/docker/docker-bake-cuda.hcl +++ /dev/null @@ -1,38 +0,0 @@ -group "default" { - targets = [ - "universe-sensing-perception-devel-cuda", - "universe-sensing-perception-cuda", - "universe-devel-cuda", - "universe-cuda" - ] -} - -// For docker/metadata-action -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-sensing-perception-devel-cuda" { - inherits = ["docker-metadata-action-universe-sensing-perception-devel-cuda"] - dockerfile = "docker/Dockerfile" - target = "universe-sensing-perception-devel-cuda" -} - -target "universe-sensing-perception-cuda" { - inherits = ["docker-metadata-action-universe-sensing-perception-cuda"] - dockerfile = "docker/Dockerfile" - target = "universe-sensing-perception-cuda" -} - -target "universe-devel-cuda" { - inherits = ["docker-metadata-action-universe-devel-cuda"] - dockerfile = "docker/Dockerfile" - target = "universe-devel-cuda" -} - -target "universe-cuda" { - inherits = ["docker-metadata-action-universe-cuda"] - dockerfile = "docker/Dockerfile" - target = "universe-cuda" -} diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index 35d0f7fdbfc..445c26a349e 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -3,7 +3,9 @@ group "default" { "base", "core-devel", "universe-sensing-perception-devel", + "universe-sensing-perception-devel-cuda", "universe-sensing-perception", + "universe-sensing-perception-cuda", "universe-localization-mapping-devel", "universe-localization-mapping", "universe-planning-control-devel", @@ -11,7 +13,9 @@ group "default" { "universe-vehicle-system-devel", "universe-vehicle-system", "universe-devel", - "universe" + "universe-devel-cuda", + "universe", + "universe-cuda" ] } @@ -19,7 +23,9 @@ group "default" { target "docker-metadata-action-base" {} target "docker-metadata-action-core-devel" {} target "docker-metadata-action-universe-sensing-perception-devel" {} +target "docker-metadata-action-universe-sensing-perception-devel-cuda" {} target "docker-metadata-action-universe-sensing-perception" {} +target "docker-metadata-action-universe-sensing-perception-cuda" {} target "docker-metadata-action-universe-localization-mapping-devel" {} target "docker-metadata-action-universe-localization-mapping" {} target "docker-metadata-action-universe-planning-control-devel" {} @@ -27,7 +33,9 @@ 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-devel" {} +target "docker-metadata-action-universe-devel-cuda" {} target "docker-metadata-action-universe" {} +target "docker-metadata-action-universe-cuda" {} target "base" { inherits = ["docker-metadata-action-base"] @@ -47,12 +55,24 @@ target "universe-sensing-perception-devel" { target = "universe-sensing-perception-devel" } +target "universe-sensing-perception-devel-cuda" { + inherits = ["docker-metadata-action-universe-sensing-perception-devel-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-sensing-perception-devel-cuda" +} + target "universe-sensing-perception" { inherits = ["docker-metadata-action-universe-sensing-perception"] dockerfile = "docker/Dockerfile" target = "universe-sensing-perception" } +target "universe-sensing-perception-cuda" { + inherits = ["docker-metadata-action-universe-sensing-perception-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-sensing-perception-cuda" +} + target "universe-localization-mapping-devel" { inherits = ["docker-metadata-action-universe-localization-mapping-devel"] dockerfile = "docker/Dockerfile" @@ -95,8 +115,20 @@ target "universe-devel" { target = "universe-devel" } +target "universe-devel-cuda" { + inherits = ["docker-metadata-action-universe-devel-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-devel-cuda" +} + target "universe" { inherits = ["docker-metadata-action-universe"] dockerfile = "docker/Dockerfile" target = "universe" } + +target "universe-cuda" { + inherits = ["docker-metadata-action-universe-cuda"] + dockerfile = "docker/Dockerfile" + target = "universe-cuda" +}