From 7593e50818191adba5759e58e0d15e0b0c7ec98b Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Wed, 4 Sep 2024 10:54:18 +0900 Subject: [PATCH] simplify rosdep-depend Signed-off-by: Yutaka Kondo --- docker/Dockerfile | 64 +++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 36 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 4f54de7b511..22e5daa557a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -33,7 +33,7 @@ RUN --mount=type=ssh \ CMD ["/bin/bash"] # hadolint ignore=DL3006 -FROM $BASE_IMAGE AS autoware-core-depend +FROM $BASE_IMAGE AS rosdep-depend SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -72,10 +72,6 @@ RUN rosdep keys --ignore-src --from-paths src \ > /rosdep-universe-common-depend-packages.txt \ && cat /rosdep-universe-common-depend-packages.txt -FROM autoware-core-depend AS autoware-universe-sensing-perception-depend -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -ARG ROS_DISTRO - COPY src/universe/autoware.universe/perception /autoware/src/universe/autoware.universe/perception COPY src/universe/autoware.universe/sensing /autoware/src/universe/autoware.universe/sensing RUN rosdep keys --ignore-src --from-paths src \ @@ -86,10 +82,6 @@ RUN rosdep keys --ignore-src --from-paths src \ > /rosdep-universe-sensing-perception-depend-packages.txt \ && cat /rosdep-universe-sensing-perception-depend-packages.txt -FROM autoware-core-depend AS autoware-universe-depend -SHELL ["/bin/bash", "-o", "pipefail", "-c"] -ARG ROS_DISTRO - COPY src/launcher /autoware/src/launcher COPY src/param /autoware/src/param COPY src/sensor_component /autoware/src/sensor_component @@ -126,7 +118,7 @@ RUN --mount=type=ssh \ && apt-get autoremove -y && rm -rf "$HOME"/.cache # Install rosdep dependencies -COPY --from=autoware-core-depend /rosdep-core-depend-packages.txt /tmp/rosdep-core-depend-packages.txt +COPY --from=rosdep-depend /rosdep-core-depend-packages.txt /tmp/rosdep-core-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ apt-get update \ @@ -134,7 +126,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ && apt-get autoremove -y && rm -rf "$HOME"/.cache RUN --mount=type=cache,target=${CCACHE_DIR} \ - --mount=type=bind,from=autoware-core-depend,source=/autoware/src/core,target=/autoware/src/core \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/core,target=/autoware/src/core \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && du -sh ${CCACHE_DIR} && ccache -s \ && colcon build --cmake-args \ @@ -152,7 +144,7 @@ ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" # Install rosdep dependencies -COPY --from=autoware-core-depend /rosdep-universe-common-depend-packages.txt /tmp/rosdep-universe-common-depend-packages.txt +COPY --from=rosdep-depend /rosdep-universe-common-depend-packages.txt /tmp/rosdep-universe-common-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ apt-get update \ @@ -162,10 +154,10 @@ RUN --mount=type=ssh \ # TODO(youtalk): Remove COPYs when https://github.com/autowarefoundation/autoware.universe/issues/8695 is resolved # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ - --mount=type=bind,from=autoware-core-depend,source=/autoware/src/universe/autoware.universe/common,target=/autoware/src/universe/autoware.universe/common \ - --mount=type=bind,from=autoware-core-depend,source=/autoware/src/universe/autoware.universe/simulator/dummy_perception_publisher,target=/autoware/src/universe/autoware.universe/simulator/dummy_perception_publisher \ - --mount=type=bind,from=autoware-core-depend,source=/autoware/src/universe/autoware.universe/vehicle/autoware_vehicle_info_utils,target=/autoware/src/universe/autoware.universe/vehicle/autoware_vehicle_info_utils \ - --mount=type=bind,from=autoware-core-depend,source=/autoware/src/universe/external,target=/autoware/src/universe/external \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/common,target=/autoware/src/universe/autoware.universe/common \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/simulator/dummy_perception_publisher,target=/autoware/src/universe/autoware.universe/simulator/dummy_perception_publisher \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/vehicle/autoware_vehicle_info_utils,target=/autoware/src/universe/autoware.universe/vehicle/autoware_vehicle_info_utils \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/external,target=/autoware/src/universe/external \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ && du -sh ${CCACHE_DIR} && ccache -s \ @@ -184,7 +176,7 @@ ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" # Install rosdep dependencies -COPY --from=autoware-universe-sensing-perception-depend /rosdep-universe-sensing-perception-depend-packages.txt /tmp/rosdep-universe-sensing-perception-depend-packages.txt +COPY --from=rosdep-depend /rosdep-universe-sensing-perception-depend-packages.txt /tmp/rosdep-universe-sensing-perception-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ apt-get update \ @@ -193,8 +185,8 @@ RUN --mount=type=ssh \ # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ - --mount=type=bind,from=autoware-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception,target=/autoware/src/universe/autoware.universe/perception \ - --mount=type=bind,from=autoware-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/sensing,target=/autoware/src/universe/autoware.universe/sensing \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/perception,target=/autoware/src/universe/autoware.universe/perception \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/sensing,target=/autoware/src/universe/autoware.universe/sensing \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ && du -sh ${CCACHE_DIR} && ccache -s \ @@ -215,7 +207,7 @@ ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" # Install rosdep dependencies -COPY --from=autoware-universe-depend /rosdep-universe-depend-packages.txt /tmp/rosdep-universe-depend-packages.txt +COPY --from=rosdep-depend /rosdep-universe-depend-packages.txt /tmp/rosdep-universe-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ apt-get update \ @@ -225,21 +217,21 @@ RUN --mount=type=ssh \ COPY --from=autoware-universe-sensing-perception /opt/autoware /opt/autoware # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/launcher,target=/autoware/src/launcher \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/param,target=/autoware/src/param \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/sensor_component,target=/autoware/src/sensor_component \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/sensor_kit,target=/autoware/src/sensor_kit \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/control,target=/autoware/src/universe/autoware.universe/control \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/evaluator,target=/autoware/src/universe/autoware.universe/evaluator \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/launch,target=/autoware/src/universe/autoware.universe/launch \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/localization,target=/autoware/src/universe/autoware.universe/localization \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/map,target=/autoware/src/universe/autoware.universe/map \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/planning,target=/autoware/src/universe/autoware.universe/planning \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/simulator,target=/autoware/src/universe/autoware.universe/simulator \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/system,target=/autoware/src/universe/autoware.universe/system \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/tools,target=/autoware/src/universe/autoware.universe/tools \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/universe/autoware.universe/vehicle,target=/autoware/src/universe/autoware.universe/vehicle \ - --mount=type=bind,from=autoware-universe-depend,source=/autoware/src/vehicle,target=/autoware/src/vehicle \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/launcher,target=/autoware/src/launcher \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/param,target=/autoware/src/param \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/sensor_component,target=/autoware/src/sensor_component \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/sensor_kit,target=/autoware/src/sensor_kit \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/control,target=/autoware/src/universe/autoware.universe/control \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/evaluator,target=/autoware/src/universe/autoware.universe/evaluator \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/launch,target=/autoware/src/universe/autoware.universe/launch \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/localization,target=/autoware/src/universe/autoware.universe/localization \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/map,target=/autoware/src/universe/autoware.universe/map \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/planning,target=/autoware/src/universe/autoware.universe/planning \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/simulator,target=/autoware/src/universe/autoware.universe/simulator \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/system,target=/autoware/src/universe/autoware.universe/system \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/tools,target=/autoware/src/universe/autoware.universe/tools \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/universe/autoware.universe/vehicle,target=/autoware/src/universe/autoware.universe/vehicle \ + --mount=type=bind,from=rosdep-depend,source=/autoware/src/vehicle,target=/autoware/src/vehicle \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ && du -sh ${CCACHE_DIR} && ccache -s \ @@ -277,7 +269,7 @@ ARG LIB_DIR ARG SETUP_ARGS # Set up runtime environment and artifacts -COPY --from=autoware-universe-depend /rosdep-exec-depend-packages.txt /tmp/rosdep-exec-depend-packages.txt +COPY --from=rosdep-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 \