diff --git a/.dockerignore b/.dockerignore index 3a5004f8199..5d2f070ee05 100644 --- a/.dockerignore +++ b/.dockerignore @@ -19,6 +19,8 @@ src/**/*.md src/**/*.pcd src/**/*.png src/**/*.svg +!src/universe/autoware.universe/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/assets +!src/universe/autoware.universe/vehicle/autoware_raw_vehicle_cmd_converter/data/default # Ignore generated files by colcon build diff --git a/autoware.repos b/autoware.repos index 9abd0d21826..a61cd39ba5f 100644 --- a/autoware.repos +++ b/autoware.repos @@ -28,7 +28,7 @@ repositories: core/autoware_lanelet2_extension: type: git url: https://github.com/autowarefoundation/autoware_lanelet2_extension.git - version: 0.6.0 + version: 0.6.1 core/autoware.core: type: git url: https://github.com/autowarefoundation/autoware.core.git diff --git a/docker/Dockerfile b/docker/Dockerfile index 9e62ce5a02e..edb8d78ba7c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -76,6 +76,10 @@ RUN rosdep keys --ignore-src --from-paths src \ > /rosdep-universe-common-depend-packages.txt \ && cat /rosdep-universe-common-depend-packages.txt +FROM rosdep-depend AS rosdep-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 \ @@ -93,6 +97,24 @@ RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ > /rosdep-universe-sensing-perception-exec-depend-packages.txt \ && cat /rosdep-universe-sensing-perception-exec-depend-packages.txt +FROM rosdep-depend AS rosdep-universe-localization-mapping-depend +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO + +COPY src/universe/autoware.universe/localization /autoware/src/universe/autoware.universe/localization +COPY src/universe/autoware.universe/map /autoware/src/universe/autoware.universe/map +RUN rosdep keys --ignore-src --from-paths src \ + | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ + | grep -v '^#' \ + | sed 's/ \+/\n/g'\ + | sort \ + > /rosdep-universe-localization-mapping-depend-packages.txt \ + && cat /rosdep-universe-localization-mapping-depend-packages.txt + +FROM rosdep-depend AS rosdep-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 @@ -165,10 +187,10 @@ RUN --mount=type=ssh \ && cat /tmp/rosdep-universe-common-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache -# 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=rosdep-depend,source=/autoware/src/universe/autoware.universe/common,target=/autoware/src/universe/autoware.universe/common \ + # TODO(youtalk): Remove --mount options when https://github.com/autowarefoundation/autoware.universe/issues/8695 is resolved --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 \ @@ -193,7 +215,7 @@ ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" # Install rosdep dependencies -COPY --from=rosdep-depend /rosdep-universe-sensing-perception-depend-packages.txt /tmp/rosdep-universe-sensing-perception-depend-packages.txt +COPY --from=rosdep-universe-sensing-perception-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 \ @@ -202,8 +224,40 @@ RUN --mount=type=ssh \ # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ - --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 \ + --mount=type=bind,from=rosdep-universe-sensing-perception-depend,source=/autoware/src/universe/autoware.universe/perception,target=/autoware/src/universe/autoware.universe/perception \ + --mount=type=bind,from=rosdep-universe-sensing-perception-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 \ + && 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 +ENV CCACHE_DIR="/root/.ccache" + +# Install rosdep dependencies +COPY --from=rosdep-universe-localization-mapping-depend /rosdep-universe-localization-mapping-depend-packages.txt /tmp/rosdep-universe-localization-mapping-depend-packages.txt +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + apt-get update \ + && cat /tmp/rosdep-universe-localization-mapping-depend-packages.txt | xargs apt-get install -y --no-install-recommends \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + +# hadolint ignore=SC1091 +RUN --mount=type=cache,target=${CCACHE_DIR} \ + --mount=type=bind,from=rosdep-universe-localization-mapping-depend,source=/autoware/src/universe/autoware.universe/localization,target=/autoware/src/universe/autoware.universe/localization \ + --mount=type=bind,from=rosdep-universe-localization-mapping-depend,source=/autoware/src/universe/autoware.universe/map,target=/autoware/src/universe/autoware.universe/map \ source /opt/ros/"$ROS_DISTRO"/setup.bash \ && source /opt/autoware/setup.bash \ && du -sh ${CCACHE_DIR} && ccache -s \ @@ -225,7 +279,7 @@ ARG ROS_DISTRO ENV CCACHE_DIR="/root/.ccache" # Install rosdep dependencies -COPY --from=rosdep-depend /rosdep-universe-depend-packages.txt /tmp/rosdep-universe-depend-packages.txt +COPY --from=rosdep-universe-depend /rosdep-universe-depend-packages.txt /tmp/rosdep-universe-depend-packages.txt # hadolint ignore=SC2002 RUN --mount=type=ssh \ apt-get update \ @@ -233,23 +287,22 @@ RUN --mount=type=ssh \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware +COPY --from=universe-localization-mapping-devel /opt/autoware /opt/autoware # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ - --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 \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/launcher,target=/autoware/src/launcher \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/param,target=/autoware/src/param \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/sensor_component,target=/autoware/src/sensor_component \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/sensor_kit,target=/autoware/src/sensor_kit \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/universe/autoware.universe/control,target=/autoware/src/universe/autoware.universe/control \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/universe/autoware.universe/evaluator,target=/autoware/src/universe/autoware.universe/evaluator \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/universe/autoware.universe/launch,target=/autoware/src/universe/autoware.universe/launch \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/universe/autoware.universe/planning,target=/autoware/src/universe/autoware.universe/planning \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/universe/autoware.universe/simulator,target=/autoware/src/universe/autoware.universe/simulator \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/universe/autoware.universe/system,target=/autoware/src/universe/autoware.universe/system \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/universe/autoware.universe/tools,target=/autoware/src/universe/autoware.universe/tools \ + --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/universe/autoware.universe/vehicle,target=/autoware/src/universe/autoware.universe/vehicle \ + --mount=type=bind,from=rosdep-universe-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 \ @@ -272,7 +325,7 @@ ARG LIB_DIR ARG SETUP_ARGS # Set up runtime environment and artifacts -COPY --from=rosdep-depend /rosdep-universe-sensing-perception-exec-depend-packages.txt /tmp/rosdep-universe-sensing-perception-exec-depend-packages.txt +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 \ @@ -306,7 +359,7 @@ ARG LIB_DIR ARG SETUP_ARGS # Set up runtime environment and artifacts -COPY --from=rosdep-depend /rosdep-exec-depend-packages.txt /tmp/rosdep-exec-depend-packages.txt +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 \ diff --git a/docker/Dockerfile.svg b/docker/Dockerfile.svg new file mode 100644 index 00000000000..6975aaaf038 --- /dev/null +++ b/docker/Dockerfile.svg @@ -0,0 +1,267 @@ + + + + + + +G + + +cluster_legend + + + + +key +FROM ...  +COPY --from=...  +RUN --mount=(.*)from=...  + + + +key2 +  +  +  + + + +key:e->key2:w + + + + + +key:e->key2:w + + + + + +key:e->key2:w + + + + + +external_image_0 + +$BASE_IMAGE + + + +stage_0 + +base + + + +external_image_0->stage_0 + + + + + +stage_1 + +rosdep-depend + + + +external_image_0->stage_1 + + + + + +stage_5 + +core-devel + + + +stage_0->stage_5 + + + + + +stage_10 + +universe-sensing-perception + + + +stage_0->stage_10 + + + + + +stage_11 + +universe + + + +stage_0->stage_11 + + + + + + +stage_1->stage_5 + + + + + +stage_2 + +rosdep-universe-sensing-perception-depend + + + +stage_1->stage_2 + + + + + + +stage_3 + +rosdep-universe-localization-mapping-depend + + + +stage_1->stage_3 + + + + + +stage_4 + +rosdep-universe-depend + + + +stage_1->stage_4 + + + + + +stage_6 + +universe-common-devel + + + +stage_1->stage_6 + + + + + +stage_5->stage_6 + + + + + +stage_2->stage_10 + + + + + +stage_7 + +universe-sensing-perception-devel + + + +stage_2->stage_7 + + + + + +stage_8 + +universe-localization-mapping-devel + + + +stage_3->stage_8 + + + + + +stage_4->stage_11 + + + + + +stage_9 + +universe-devel + + + +stage_4->stage_9 + + + + + +stage_6->stage_7 + + + + + +stage_6->stage_8 + + + + + +stage_6->stage_9 + + + + + +stage_7->stage_10 + + + + + +stage_7->stage_9 + + + + + +stage_8->stage_9 + + + + + +stage_9->stage_11 + + + + + diff --git a/docker/README.md b/docker/README.md index 4e5854710be..91f959b6197 100644 --- a/docker/README.md +++ b/docker/README.md @@ -6,7 +6,9 @@ Detailed instructions on how to use the containers can be found in the [Open AD ## Multi-stage Dockerfile structure -![](./img/Dockerfile.svg) +![](./Dockerfile.svg) + +The suffix `-devel` (e.g. `universe-devel`) is intended for use as a [development container](https://containers.dev). On the other hand, those without the `-devel` suffix (e.g. `universe`) are intended to be used as a runtime container. ### `$BASE_IMAGE` @@ -18,28 +20,67 @@ This stage performs only the basic setup required for all Autoware images. ### `rosdep-depend` -The following three ROS dependency package list files will be generated: - -- `/rosdep-core-depend-packages.txt`: A dependency package list file for the packages under the `core` directory of `autoware.repos`. -- `/rosdep-universe-depend-packages.txt`: A dependency package list file for the packages under the `universe` directory of `autoware.repos`. -- `/rosdep-exec-depend-packages.txt`: A dependency package list file required for running Autoware. +The ROS dependency package list files will be generated. +These files will be used in the subsequent stages: -These files will be used in the subsequent `autoware-core`, `autoware-universe`, and `runtime` stages. +- `core-devel` +- `universe-common` +- `universe-COMPONENT-devel` (e.g. `universe-sensing-perception-devel`) +- `universe-COMPONENT` (e.g. `universe-sensing-perception`) +- `universe-devel` +- `universe` By generating only the package list files and copying them to the subsequent stages, the dependency packages will not be reinstalled during the container build process unless the dependency packages change. -### `autoware-core` +### `core-devel` This stage installs the dependency packages based on `/rosdep-core-depend-packages.txt` and build the packages under the `core` directory of `autoware.repos`. -### `autoware-universe` +### `universe-common-devel` + +This stage installs the dependency packages based on `/rosdep-universe-common-depend-packages.txt` and build the packages under the following directories of `autoware.repos`. + +- `universe/external` +- `universe/autoware.universe/common` + +### `universe-sensing-perception-devel` + +This stage installs the dependency packages based on `/rosdep-universe-sensing-perception-depend-packages.txt` and build the packages under the following directories of `autoware.repos`. + +- `universe/autoware.universe/perception` +- `universe/autoware.universe/sensing` + +### `universe-sensing-perception` + +This stage is a Autoware Universe Sensing/Perception runtime container. It only includes the dependencies given by `/rosdep-universe-sensing-perception-exec-depend-packages.txt` and the binaries built in the `universe-sensing-perception-devel` stage. + +### `universe-localization-mapping-devel` + +This stage installs the dependency packages based on `/rosdep-universe-localization-mapping-depend-packages.txt` and build the packages under the following directories of `autoware.repos`. + +- `universe/autoware.universe/localization` +- `universe/autoware.universe/map` + +### `universe-devel` -This stage installs the dependency packages based on `/rosdep-universe-depend-packages.txt` and build the packages under the `universe` directory of `autoware.repos`. +This stage installs the dependency packages based on `/rosdep-universe-depend-packages.txt` and build the remaining packages of `autoware.repos`: -### `devel` +- `launcher` +- `param` +- `sensor_component` +- `sensor_kit` +- `universe/autoware.universe/control` +- `universe/autoware.universe/evaluator` +- `universe/autoware.universe/launch` +- `universe/autoware.universe/planning` +- `universe/autoware.universe/simulator` +- `universe/autoware.universe/system` +- `universe/autoware.universe/tools` +- `universe/autoware.universe/vehicle` +- `vehicle` -This stage provides a [development container](https://containers.dev) to Autoware developers. By running the host's source code with volume mounting, it allows for easy building and debugging of Autoware. +This stage provides an all-in-one development container to Autoware developers. By running the host's source code with volume mounting, it allows for easy building and debugging of Autoware. -### `runtime` +### `universe` -This stage is an Autoware runtime container. It only includes the dependencies given by `/rosdep-exec-depend-packages.txt`, the binaries built in the `autoware-universe` stage, and artifacts. +This stage is an Autoware Universe runtime container. It only includes the dependencies given by `/rosdep-exec-depend-packages.txt`, the binaries built in the `universe-devel` stage, and artifacts. diff --git a/docker/img/Dockerfile.svg b/docker/img/Dockerfile.svg deleted file mode 100644 index cd4341a66ec..00000000000 --- a/docker/img/Dockerfile.svg +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - -G - - -cluster_legend - - - - -key -FROM ...  -COPY --from=...  -RUN --mount=(.*)from=...  - - - -key2 -  -  -  - - - -key:e->key2:w - - - - - -key:e->key2:w - - - - - -key:e->key2:w - - - - - -external_image_0 - -$BASE_IMAGE - - - -stage_0 - -base - - - -external_image_0->stage_0 - - - - - -stage_1 - -rosdep-depend - - - -external_image_0->stage_1 - - - - - -stage_2 - -autoware-core - - - -stage_0->stage_2 - - - - - -stage_5 - -runtime - - - -stage_0->stage_5 - - - - - -stage_1->stage_2 - - - - - -stage_1->stage_2 - - - - - -stage_3 - -autoware-universe - - - -stage_1->stage_3 - - - - - -stage_1->stage_3 - - - - - -stage_1->stage_5 - - - - - -stage_2->stage_3 - - - - - -stage_4 - -devel - - - -stage_3->stage_4 - - - - - -stage_3->stage_5 - - - - -