From bd793d207ddd5ce51a4d729df9fd4137ac30d371 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Mon, 9 Sep 2024 21:33:40 +0900 Subject: [PATCH] feat(docker): add `universe-planning-control` runtime image (#5195) * update docker Signed-off-by: Yutaka Kondo * update action Signed-off-by: Yutaka Kondo * update readme Signed-off-by: Yutaka Kondo * fix images Signed-off-by: Yutaka Kondo * not download artifacts Signed-off-by: Yutaka Kondo * add universe-planning-control-devel Signed-off-by: Yutaka Kondo * fix copy Signed-off-by: Yutaka Kondo * add copy Signed-off-by: Yutaka Kondo * fix copy Signed-off-by: Yutaka Kondo * add linefeed Signed-off-by: Yutaka Kondo * add pcl Signed-off-by: Yutaka Kondo * update svg Signed-off-by: Yutaka Kondo * update readme Signed-off-by: Yutaka Kondo * add planning-control image Signed-off-by: Yutaka Kondo * update svg Signed-off-by: Yutaka Kondo * use ghcr.io Signed-off-by: Yutaka Kondo * update readme Signed-off-by: Yutaka Kondo * not download artifacts Signed-off-by: Yutaka Kondo * chore(docker): remove ansible config files from runtime images (#5192) * remove ansible files from runtime images Signed-off-by: Yutaka Kondo * update rm -rf Signed-off-by: Yutaka Kondo --------- Signed-off-by: Yutaka Kondo --------- Signed-off-by: Yutaka Kondo --- .../actions/docker-build-and-push/action.yaml | 24 ++ docker/Dockerfile | 47 ++- docker/Dockerfile.svg | 323 ++++++++++-------- docker/README.md | 4 + docker/docker-bake.hcl | 16 + 5 files changed, 262 insertions(+), 152 deletions(-) diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 4c9ab208345..1d4af106e13 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -155,6 +155,28 @@ runs: latest=false suffix=-universe-localization-mapping${{ inputs.tag-suffix }} + - name: Docker meta for autoware:universe-planning-control-devel + id: meta-universe-planning-control-devel + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: ${{ steps.set-docker-tags.outputs.tags }} + bake-target: docker-metadata-action-universe-planning-control-devel + flavor: | + latest=false + suffix=-universe-planning-control-devel${{ inputs.tag-suffix }} + + - name: Docker meta for autoware:universe-planning-control + id: meta-universe-planning-control + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ inputs.bake-target }} + tags: ${{ steps.set-docker-tags.outputs.tags }} + bake-target: docker-metadata-action-universe-planning-control + flavor: | + latest=false + suffix=-universe-planning-control${{ inputs.tag-suffix }} + - name: Docker meta for autoware:universe-devel id: meta-universe-devel uses: docker/metadata-action@v5 @@ -196,6 +218,8 @@ runs: ${{ steps.meta-universe-sensing-perception.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 }} + ${{ steps.meta-universe-planning-control.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 785c8bc67c3..d53659d5c17 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -136,6 +136,13 @@ RUN rosdep keys --ignore-src --from-paths src \ | sort \ > /rosdep-universe-planning-control-depend-packages.txt \ && cat /rosdep-universe-planning-control-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-planning-control-exec-depend-packages.txt \ + && cat /rosdep-universe-planning-control-exec-depend-packages.txt FROM rosdep-depend AS rosdep-universe-depend SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -397,7 +404,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 \ + && 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* @@ -431,7 +438,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 \ + && 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* @@ -445,6 +452,40 @@ RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] +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 \ + && 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 \ + && 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-planning-control-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 @@ -465,7 +506,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 \ + && 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* diff --git a/docker/Dockerfile.svg b/docker/Dockerfile.svg index 87eddd635b6..a54e635be43 100644 --- a/docker/Dockerfile.svg +++ b/docker/Dockerfile.svg @@ -4,324 +4,349 @@ - - + + 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 + +core-devel stage_0->stage_6 - - + + stage_12 - -universe-sensing-perception + +universe-sensing-perception stage_0->stage_12 - - + + + stage_13 - -universe-localization-mapping + +universe-localization-mapping stage_0->stage_13 - - + stage_14 - -universe + +universe-planning-control stage_0->stage_14 - - - + + + + + + +stage_15 + +universe + + + +stage_0->stage_15 + + - + stage_1->stage_6 - - + + - + 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-depend - + stage_1->stage_5 - - + + + - + stage_7 - -universe-common-devel + +universe-common-devel - + stage_1->stage_7 - - + + - + stage_6->stage_7 - - + + - + stage_2->stage_12 - - + + - + stage_8 - -universe-sensing-perception-devel + +universe-sensing-perception-devel - + stage_2->stage_8 - - + + - + stage_3->stage_13 - - + + + - + stage_9 - -universe-localization-mapping-devel + +universe-localization-mapping-devel - + stage_3->stage_9 - - + + + + + +stage_4->stage_14 + + - + stage_10 - -universe-planning-control-devel + +universe-planning-control-devel - + stage_4->stage_10 - - + + - - -stage_5->stage_14 - - + + +stage_5->stage_15 + + - + stage_11 - -universe-devel + +universe-devel - + stage_5->stage_11 - - + + - + stage_7->stage_8 - - + + - + stage_7->stage_9 - - + + - + stage_7->stage_10 - - + + - + stage_7->stage_11 - - + + - + stage_8->stage_12 - - + + - + stage_8->stage_11 - - + + - + stage_9->stage_13 - - + + - + stage_9->stage_11 - - + + + + + +stage_10->stage_14 + + - + stage_10->stage_11 - - - - - -stage_11->stage_14 - - + + + + + +stage_11->stage_15 + + diff --git a/docker/README.md b/docker/README.md index a1a114c739a..3d600ccfe30 100644 --- a/docker/README.md +++ b/docker/README.md @@ -72,6 +72,10 @@ This stage installs the dependency packages based on `/rosdep-universe-planning- - `universe/autoware.universe/control` - `universe/autoware.universe/planning` +### `universe-planning-control` + +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-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 274f5725a41..cc544f2409e 100644 --- a/docker/docker-bake.hcl +++ b/docker/docker-bake.hcl @@ -6,6 +6,8 @@ group "default" { "universe-sensing-perception", "universe-localization-mapping-devel", "universe-localization-mapping", + "universe-planning-control-devel", + "universe-planning-control", "universe-devel", "universe" ] @@ -18,6 +20,8 @@ target "docker-metadata-action-universe-sensing-perception-devel" {} target "docker-metadata-action-universe-sensing-perception" {} 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-devel" {} target "docker-metadata-action-universe" {} @@ -57,6 +61,18 @@ target "universe-localization-mapping" { target = "universe-localization-mapping" } +target "universe-planning-control-devel" { + inherits = ["docker-metadata-action-universe-planning-control-devel"] + dockerfile = "docker/Dockerfile" + target = "universe-planning-control-devel" +} + +target "universe-planning-control" { + inherits = ["docker-metadata-action-universe-planning-control"] + dockerfile = "docker/Dockerfile" + target = "universe-planning-control" +} + target "universe-devel" { inherits = ["docker-metadata-action-universe-devel"] dockerfile = "docker/Dockerfile"