Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(docker): introduce rosdep-installed stage #6

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ansible/playbooks/openadk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ansible/playbooks/universe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
40 changes: 19 additions & 21 deletions docker/autoware-openadk/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -68,6 +55,23 @@ RUN --mount=type=ssh \
&& 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

# Build Autoware
RUN source /opt/ros/"$ROS_DISTRO"/setup.bash \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --cmake-args \
Expand Down Expand Up @@ -96,22 +100,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 \
Expand Down
Loading