Skip to content

Commit

Permalink
feat(docker): introduce autoware-universe-common stage (autowarefou…
Browse files Browse the repository at this point in the history
…ndation#5157)

* add universe-common stage

Signed-off-by: Yutaka Kondo <[email protected]>

* create -common list

Signed-off-by: Yutaka Kondo <[email protected]>

* install dummy

Signed-off-by: Yutaka Kondo <[email protected]>

* Revert "create -common list"

This reverts commit 0b478c1.

* Revert "Revert "create -common list""

This reverts commit a682ee3.

* move launcher to universe

Signed-off-by: Yutaka Kondo <[email protected]>

* reorder

Signed-off-by: Yutaka Kondo <[email protected]>

* reorder

Signed-off-by: Yutaka Kondo <[email protected]>

* copy 2 packages

Signed-off-by: Yutaka Kondo <[email protected]>

* mount 2 packages

Signed-off-by: Yutaka Kondo <[email protected]>

* add todo

Signed-off-by: Yutaka Kondo <[email protected]>

* remove linefeed

Signed-off-by: Yutaka Kondo <[email protected]>

---------

Signed-off-by: Yutaka Kondo <[email protected]>
  • Loading branch information
youtalk authored Sep 3, 2024
1 parent 99786d7 commit 28deda8
Showing 1 changed file with 57 additions and 4 deletions.
61 changes: 57 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ RUN rosdep update && rosdep keys --ignore-src --from-paths src \
| sort \
> /rosdep-core-depend-packages.txt \
&& cat /rosdep-core-depend-packages.txt
COPY src/universe/external /autoware/src/universe/external
COPY src/universe/autoware.universe/common /autoware/src/universe/autoware.universe/common
# TODO(youtalk): Remove COPYs when https://github.com/autowarefoundation/autoware.universe/issues/8695 is resolved
COPY src/universe/autoware.universe/simulator/dummy_perception_publisher /autoware/src/universe/autoware.universe/simulator/dummy_perception_publisher
COPY src/universe/autoware.universe/vehicle/autoware_vehicle_info_utils /autoware/src/universe/autoware.universe/vehicle/autoware_vehicle_info_utils
RUN rosdep keys --ignore-src --from-paths src \
| xargs rosdep resolve --rosdistro ${ROS_DISTRO} \
| grep -v '^#' \
| sed 's/ \+/\n/g'\
| sort \
> /rosdep-universe-common-depend-packages.txt \
&& cat /rosdep-universe-common-depend-packages.txt
COPY src/launcher /autoware/src/launcher
COPY src/param /autoware/src/param
COPY src/sensor_component /autoware/src/sensor_component
Expand Down Expand Up @@ -113,10 +125,41 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \
&& du -sh ${CCACHE_DIR} && ccache -s \
&& rm -rf /autoware/build

FROM autoware-core AS autoware-universe
FROM autoware-core AS autoware-universe-common
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ENV CCACHE_DIR="/root/.ccache"

# Install rosdep dependencies
COPY --from=rosdep-depend /rosdep-universe-common-depend-packages.txt /tmp/rosdep-universe-common-depend-packages.txt
# hadolint ignore=SC2002
RUN --mount=type=ssh \
apt-get update \
&& 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 \
--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 \
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

FROM autoware-universe-common AS autoware-universe
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG SETUP_ARGS
ENV CCACHE_DIR="/root/.ccache"

# Install rosdep dependencies
Expand All @@ -127,14 +170,24 @@ RUN --mount=type=ssh \
&& cat /tmp/rosdep-universe-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

# Build 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,target=/autoware/src/universe \
--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/perception,target=/autoware/src/universe/autoware.universe/perception \
--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/sensing,target=/autoware/src/universe/autoware.universe/sensing \
--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 \
source /opt/ros/"$ROS_DISTRO"/setup.bash \
&& source /opt/autoware/setup.bash \
Expand Down

0 comments on commit 28deda8

Please sign in to comment.