From 7b53926eea284f3ce4267167be6c23e275ee8cb0 Mon Sep 17 00:00:00 2001 From: Yutaka Kondo Date: Wed, 24 Apr 2024 17:24:40 +0900 Subject: [PATCH] introduce rosdep-installed stage Signed-off-by: Yutaka Kondo --- ansible/playbooks/openadk.yaml | 4 +-- ansible/playbooks/universe.yaml | 4 +-- docker/autoware-openadk/Dockerfile | 42 ++++++++++++++---------------- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/ansible/playbooks/openadk.yaml b/ansible/playbooks/openadk.yaml index f343d9cef55..bfb338dad2f 100644 --- a/ansible/playbooks/openadk.yaml +++ b/ansible/playbooks/openadk.yaml @@ -26,6 +26,8 @@ when: module == 'base' - role: autoware.dev_env.build_tools when: module == 'all' and install_devel=='y' + - role: autoware.dev_env.pacmod + when: module == 'base' # Module specific dependencies - role: autoware.dev_env.geographiclib @@ -34,8 +36,6 @@ when: (module == 'perception-localization' or module == 'all') and prompt_install_nvidia=='y' - role: autoware.dev_env.tensorrt when: (module == 'perception-localization' or module == 'all') and prompt_install_nvidia=='y' - - role: autoware.dev_env.pacmod - when: module == 'planning-control' or module == 'perception-localization' or module == 'all' # Development environment - role: autoware.dev_env.dev_tools diff --git a/ansible/playbooks/universe.yaml b/ansible/playbooks/universe.yaml index e443c041bc5..f34fbbddd03 100644 --- a/ansible/playbooks/universe.yaml +++ b/ansible/playbooks/universe.yaml @@ -45,13 +45,13 @@ - role: autoware.dev_env.rmw_implementation - role: autoware.dev_env.gdown - role: autoware.dev_env.build_tools + - role: autoware.dev_env.pacmod + when: rosdistro != 'rolling' # Autoware module dependencies - role: autoware.dev_env.geographiclib - role: autoware.dev_env.cuda when: prompt_install_nvidia == 'y' - - role: autoware.dev_env.pacmod - when: rosdistro != 'rolling' - role: autoware.dev_env.tensorrt when: prompt_install_nvidia == 'y' diff --git a/docker/autoware-openadk/Dockerfile b/docker/autoware-openadk/Dockerfile index c7ce5cca809..7d72f6f232d 100644 --- a/docker/autoware-openadk/Dockerfile +++ b/docker/autoware-openadk/Dockerfile @@ -39,22 +39,9 @@ RUN --mount=type=ssh \ # Create entrypoint CMD ["/bin/bash"] -FROM base as prebuilt +FROM base as rosdep-installed SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO -ARG SETUP_ARGS -ENV CCACHE_DIR="/var/tmp/ccache" -ENV CC="/usr/lib/ccache/gcc" -ENV CXX="/usr/lib/ccache/g++" - -# cspell: ignore libcu libnv -# Set up development environment -RUN --mount=type=ssh \ - ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers openadk \ - && pip uninstall -y ansible ansible-core \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache \ - && find / -name 'libcu*.a' -delete \ - && find / -name 'libnv*.a' -delete # Copy repository files COPY autoware.repos /autoware/ @@ -66,6 +53,24 @@ RUN --mount=type=ssh \ && apt-get update \ && rosdep update \ && DEBIAN_FRONTEND=noninteractive rosdep install -y --ignore-src --from-paths src --rosdistro "$ROS_DISTRO" \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache + +FROM rosdep-installed as prebuilt +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +ARG ROS_DISTRO +ARG SETUP_ARGS +ENV CCACHE_DIR="/var/tmp/ccache" +ENV CC="/usr/lib/ccache/gcc" +ENV CXX="/usr/lib/ccache/g++" + +# cspell: ignore libcu libnv +# Set up development environment and build release binaries +RUN --mount=type=ssh \ + ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --no-cuda-drivers openadk \ + && pip uninstall -y ansible ansible-core \ + && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache \ + && find / -name 'libcu*.a' -delete \ + && find / -name 'libnv*.a' -delete \ && source /opt/ros/"$ROS_DISTRO"/setup.bash \ && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --cmake-args \ " -Wno-dev" \ @@ -74,7 +79,6 @@ RUN --mount=type=ssh \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ && find /autoware/install -type d -exec chmod 777 {} \; \ && chmod -R 777 /var/tmp/ccache \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache \ && rm -rf /autoware/build /autoware/src CMD ["/bin/bash"] @@ -94,22 +98,16 @@ RUN chmod +x /ros_entrypoint.sh ENTRYPOINT ["/ros_entrypoint.sh"] CMD ["/bin/bash"] -FROM base as runtime +FROM rosdep-installed as runtime SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG LIB_DIR ARG SETUP_ARGS # Set up runtime environment and artifacts -COPY autoware.repos /autoware/ RUN --mount=type=ssh \ ./setup-dev-env.sh -y --module all ${SETUP_ARGS} --download-artifacts --no-cuda-drivers --runtime openadk \ && pip uninstall -y ansible ansible-core \ - && mkdir src \ - && vcs import src < autoware.repos \ - && rosdep update \ - && DEBIAN_FRONTEND=noninteractive rosdep install -y --dependency-types=exec --ignore-src --from-paths src --rosdistro "$ROS_DISTRO" \ - && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$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 \