From f24de1e59f3c233b000ff12bc13f37be93174f55 Mon Sep 17 00:00:00 2001 From: oguzkaganozt Date: Fri, 27 Sep 2024 12:33:46 +0300 Subject: [PATCH] feat(docker): add vehicle-system container (#5257) * add vehicle-system container Signed-off-by: Oguz Ozturk * add to bakefile and workflow Signed-off-by: Oguz Ozturk * style(pre-commit): autofix * add missing tag info Signed-off-by: Oguz Ozturk * update documentation Signed-off-by: Oguz Ozturk * add missing dependencies Signed-off-by: Oguz Ozturk * update svg Signed-off-by: Oguz Ozturk --------- Signed-off-by: Oguz Ozturk Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .../actions/docker-build-and-push/action.yaml | 26 + docker/Dockerfile | 94 +++- docker/Dockerfile.svg | 500 ++++++++++-------- docker/README.md | 11 + docker/docker-bake.hcl | 16 + 5 files changed, 426 insertions(+), 221 deletions(-) diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 903ef8de109..b7e6b393b1e 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -168,6 +168,30 @@ runs: flavor: | latest=false + - name: Docker meta for autoware:universe-vehicle-system-devel + id: meta-universe-vehicle-system-devel + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-vehicle-system-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }} + type=raw,value=universe-vehicle-system-devel${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }} + bake-target: docker-metadata-action-universe-vehicle-system-devel + flavor: | + latest=false + + - name: Docker meta for autoware:universe-vehicle-system + id: meta-universe-vehicle-system + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: | + type=raw,value=universe-vehicle-system${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }} + type=raw,value=universe-vehicle-system${{ inputs.tag-suffix && '-' }}${{ inputs.tag-suffix }}-${{ steps.date.outputs.date }} + bake-target: docker-metadata-action-universe-vehicle-system + flavor: | + latest=false + - name: Docker meta for autoware:universe-devel id: meta-universe-devel uses: docker/metadata-action@v5 @@ -213,6 +237,8 @@ runs: ${{ steps.meta-universe-localization-mapping.outputs.bake-file }} ${{ steps.meta-universe-planning-control-devel.outputs.bake-file }} ${{ steps.meta-universe-planning-control.outputs.bake-file }} + ${{ 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.outputs.bake-file }} provenance: false diff --git a/docker/Dockerfile b/docker/Dockerfile index bc2917ca949..efde0797845 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -141,6 +141,29 @@ RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ > /rosdep-universe-planning-control-exec-depend-packages.txt \ && cat /rosdep-universe-planning-control-exec-depend-packages.txt +FROM rosdep-depend AS rosdep-universe-vehicle-system-depend +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO + +COPY src/universe/autoware.universe/vehicle /autoware/src/universe/autoware.universe/vehicle +COPY src/universe/autoware.universe/system /autoware/src/universe/autoware.universe/system +COPY src/universe/autoware.universe/map/autoware_map_height_fitter /autoware/src/universe/autoware.universe/map/autoware_map_height_fitter +COPY src/universe/autoware.universe/localization/autoware_pose2twist /autoware/src/universe/autoware.universe/localization/autoware_pose2twist +RUN rosdep keys --ignore-src --from-paths src \ + | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ + | grep -v '^#' \ + | sed 's/ \+/\n/g'\ + | sort \ + > /rosdep-universe-vehicle-system-depend-packages.txt \ + && cat /rosdep-universe-vehicle-system-depend-packages.txt +RUN rosdep keys --dependency-types=exec --ignore-src --from-paths src \ + | xargs rosdep resolve --rosdistro ${ROS_DISTRO} \ + | grep -v '^#' \ + | sed 's/ \+/\n/g'\ + | sort \ + > /rosdep-universe-vehicle-system-exec-depend-packages.txt \ + && cat /rosdep-universe-vehicle-system-exec-depend-packages.txt + FROM rosdep-depend AS rosdep-universe-depend SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -334,6 +357,40 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +FROM universe-common-devel AS universe-vehicle-system-devel +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ENV CCACHE_DIR="/root/.ccache" + +# Install rosdep dependencies +COPY --from=rosdep-universe-vehicle-system-depend /rosdep-universe-vehicle-system-depend-packages.txt /tmp/rosdep-universe-vehicle-system-depend-packages.txt +# hadolint ignore=SC2002 +RUN --mount=type=ssh \ + apt-get update \ + && cat /tmp/rosdep-universe-vehicle-system-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-vehicle-system-depend,source=/autoware/src/universe/autoware.universe/vehicle,target=/autoware/src/universe/autoware.universe/vehicle \ + --mount=type=bind,from=rosdep-universe-vehicle-system-depend,source=/autoware/src/universe/autoware.universe/system,target=/autoware/src/universe/autoware.universe/system \ + --mount=type=bind,from=rosdep-universe-vehicle-system-depend,source=/autoware/src/universe/autoware.universe/map/autoware_map_height_fitter,target=/autoware/src/universe/autoware.universe/map/autoware_map_height_fitter \ + --mount=type=bind,from=rosdep-universe-vehicle-system-depend,source=/autoware/src/universe/autoware.universe/localization/autoware_pose2twist,target=/autoware/src/universe/autoware.universe/localization/autoware_pose2twist \ + source /opt/ros/"$ROS_DISTRO"/setup.bash \ + && source /opt/autoware/setup.bash \ + && 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-devel SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO @@ -350,6 +407,7 @@ RUN --mount=type=ssh \ COPY --from=universe-sensing-perception-devel /opt/autoware /opt/autoware COPY --from=universe-localization-mapping-devel /opt/autoware /opt/autoware COPY --from=universe-planning-control-devel /opt/autoware /opt/autoware +COPY --from=universe-vehicle-system-devel /opt/autoware /opt/autoware # hadolint ignore=SC1091 RUN --mount=type=cache,target=${CCACHE_DIR} \ --mount=type=bind,from=rosdep-universe-depend,source=/autoware/src/launcher,target=/autoware/src/launcher \ @@ -359,9 +417,7 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \ --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/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 \ @@ -480,6 +536,40 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +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 \ + && 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 \ + && 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-vehicle-system-devel /opt/autoware /opt/autoware + +# Copy bash aliases +COPY docker/etc/.bash_aliases /root/.bash_aliases +RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc + +ENTRYPOINT ["/ros_entrypoint.sh"] +CMD ["/bin/bash"] + FROM base AS universe SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO diff --git a/docker/Dockerfile.svg b/docker/Dockerfile.svg index a54e635be43..a8d5d4e1d37 100644 --- a/docker/Dockerfile.svg +++ b/docker/Dockerfile.svg @@ -1,352 +1,414 @@ - - - + + 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_6 - -core-devel +stage_7 + +core-devel - + -stage_0->stage_6 - - +stage_0->stage_7 + + - + -stage_12 - -universe-sensing-perception +stage_14 + +universe-sensing-perception - + -stage_0->stage_12 - - - +stage_0->stage_14 + + + - + -stage_13 - -universe-localization-mapping +stage_15 + +universe-localization-mapping - + -stage_0->stage_13 - +stage_0->stage_15 + + - + -stage_14 - -universe-planning-control +stage_16 + +universe-planning-control - + -stage_0->stage_14 - - - +stage_0->stage_16 + + + + - + -stage_15 - -universe +stage_17 + +universe-vehicle-system - + -stage_0->stage_15 - - +stage_0->stage_17 + - - -stage_1->stage_6 - - + + +stage_18 + +universe + + + +stage_0->stage_18 + + + + + +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-depend + +rosdep-universe-vehicle-system-depend - + stage_1->stage_5 - - - - - - -stage_7 - -universe-common-devel - - - -stage_1->stage_7 - - + + - - -stage_6->stage_7 - - + + +stage_6 + +rosdep-universe-depend - - -stage_2->stage_12 - - + + +stage_1->stage_6 + + + - + stage_8 - -universe-sensing-perception-devel + +universe-common-devel - - -stage_2->stage_8 - - + + +stage_1->stage_8 + + - - -stage_3->stage_13 - - - + + +stage_7->stage_8 + + + + + +stage_2->stage_14 + + - + stage_9 - -universe-localization-mapping-devel + +universe-sensing-perception-devel - - -stage_3->stage_9 - - + + +stage_2->stage_9 + + - - -stage_4->stage_14 - - + + +stage_3->stage_15 + + - + stage_10 - -universe-planning-control-devel + +universe-localization-mapping-devel - - -stage_4->stage_10 - - + + +stage_3->stage_10 + + - - -stage_5->stage_15 - - + + +stage_4->stage_16 + + - + stage_11 - -universe-devel + +universe-planning-control-devel - - -stage_5->stage_11 - - + + +stage_4->stage_11 + + - - -stage_7->stage_8 - - + + +stage_5->stage_17 + + + - - -stage_7->stage_9 - - + + +stage_12 + +universe-vehicle-system-devel - + + +stage_5->stage_12 + + + + -stage_7->stage_10 - - +stage_6->stage_18 + + - - -stage_7->stage_11 - - + + +stage_13 + +universe-devel - - -stage_8->stage_12 - - + + +stage_6->stage_13 + + - + -stage_8->stage_11 - - +stage_8->stage_9 + + - - -stage_9->stage_13 - - + + +stage_8->stage_10 + + - + -stage_9->stage_11 - - +stage_8->stage_11 + + - - -stage_10->stage_14 - - + + +stage_8->stage_12 + + - + -stage_10->stage_11 - - +stage_8->stage_13 + + - + -stage_11->stage_15 - - +stage_9->stage_14 + + + + + +stage_9->stage_13 + + + + + +stage_10->stage_15 + + + + + +stage_10->stage_13 + + + + + +stage_11->stage_16 + + + + + +stage_11->stage_13 + + + + + +stage_12->stage_17 + + + + + +stage_12->stage_13 + + + + + +stage_13->stage_18 + + diff --git a/docker/README.md b/docker/README.md index 3d600ccfe30..14c39306153 100644 --- a/docker/README.md +++ b/docker/README.md @@ -76,6 +76,17 @@ This stage installs the dependency packages based on `/rosdep-universe-planning- This stage is a Autoware Universe Planning/Control runtime container. It only includes the dependencies given by `/rosdep-universe-planning-control-exec-depend-packages.txt` and the binaries built in the `universe-planning-control-devel` stage. +### `universe-vehicle-system-devel` + +This stage installs the dependency packages based on `/rosdep-universe-vehicle-system-depend-packages.txt` and build the packages under the following directories of `autoware.repos`. + +- `universe/autoware.universe/vehicle` +- `universe/autoware.universe/system` + +### `universe-vehicle-system` + +This stage is a Autoware Universe Vehicle/System runtime container. It only includes the dependencies given by `/rosdep-universe-vehicle-system-exec-depend-packages.txt` and the binaries built in the `universe-vehicle-system-devel` stage. + ### `universe-devel` This stage installs the dependency packages based on `/rosdep-universe-depend-packages.txt` and build the remaining packages of `autoware.repos`: diff --git a/docker/docker-bake.hcl b/docker/docker-bake.hcl index cc544f2409e..35d0f7fdbfc 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -8,6 +8,8 @@ group "default" { "universe-localization-mapping", "universe-planning-control-devel", "universe-planning-control", + "universe-vehicle-system-devel", + "universe-vehicle-system", "universe-devel", "universe" ] @@ -22,6 +24,8 @@ target "docker-metadata-action-universe-localization-mapping-devel" {} target "docker-metadata-action-universe-localization-mapping" {} target "docker-metadata-action-universe-planning-control-devel" {} target "docker-metadata-action-universe-planning-control" {} +target "docker-metadata-action-universe-vehicle-system-devel" {} +target "docker-metadata-action-universe-vehicle-system" {} target "docker-metadata-action-universe-devel" {} target "docker-metadata-action-universe" {} @@ -73,6 +77,18 @@ target "universe-planning-control" { target = "universe-planning-control" } +target "universe-vehicle-system-devel" { + inherits = ["docker-metadata-action-universe-vehicle-system-devel"] + dockerfile = "docker/Dockerfile" + target = "universe-vehicle-system-devel" +} + +target "universe-vehicle-system" { + inherits = ["docker-metadata-action-universe-vehicle-system"] + dockerfile = "docker/Dockerfile" + target = "universe-vehicle-system" +} + target "universe-devel" { inherits = ["docker-metadata-action-universe-devel"] dockerfile = "docker/Dockerfile"