Skip to content

Commit

Permalink
install to /opt/autoware
Browse files Browse the repository at this point in the history
Signed-off-by: Yutaka Kondo <[email protected]>
  • Loading branch information
youtalk committed Aug 15, 2024
1 parent 18d64b0 commit 2befe91
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
21 changes: 12 additions & 9 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
# Copy files
COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/
COPY ansible/ /autoware/ansible/
WORKDIR /autoware

# Set up development environment
RUN --mount=type=ssh \
Expand All @@ -28,13 +27,16 @@ RUN --mount=type=ssh \
&& apt-get autoremove -y && rm -rf "$HOME"/.cache

# Build autoware.core
WORKDIR /autoware
RUN --mount=type=cache,target=${CCACHE_DIR} \
--mount=type=bind,source=src/core,target=/autoware/src/core \
source /opt/ros/"$ROS_DISTRO"/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

Expand All @@ -58,7 +60,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
# Copy files
COPY setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/
COPY ansible/ /autoware/ansible/
WORKDIR /autoware

# Set up development environment
RUN --mount=type=ssh \
Expand All @@ -67,7 +68,10 @@ RUN --mount=type=ssh \
&& pip uninstall -y ansible ansible-core \
&& apt-get autoremove -y && rm -rf "$HOME"/.cache

COPY --from=autoware-core /opt/autoware /opt/autoware

# Build autoware.universe
WORKDIR /autoware
RUN --mount=type=cache,target=${CCACHE_DIR} \
--mount=type=bind,source=src/launcher,target=/autoware/src/launcher \
--mount=type=bind,source=src/param,target=/autoware/src/param \
Expand All @@ -76,10 +80,13 @@ RUN --mount=type=cache,target=${CCACHE_DIR} \
--mount=type=bind,source=src/universe,target=/autoware/src/universe \
--mount=type=bind,source=src/vehicle,target=/autoware/src/vehicle \
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

Expand All @@ -102,21 +109,17 @@ RUN chmod +x /ros_entrypoint.sh
ENTRYPOINT ["/ros_entrypoint.sh"]
CMD ["/bin/bash"]

FROM base as runtime
FROM youtalk/autoware-base:latest-humble-runtime-base as runtime
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
ARG ROS_DISTRO
ARG LIB_DIR
ARG SETUP_ARGS

# Set up runtime environment and artifacts
COPY --from=rosdep-depend /rosdep-exec-depend-packages.txt /tmp/rosdep-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} --download-artifacts --no-cuda-drivers --runtime openadkit \
&& pip uninstall -y ansible ansible-core \
&& apt-get update \
&& cat /tmp/rosdep-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 \
Expand All @@ -127,11 +130,11 @@ RUN --mount=type=ssh \
/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=autoware-universe /autoware/install/ /autoware/install/
COPY --from=autoware-universe /opt/autoware /opt/autoware

# Copy bash aliases
COPY docker/etc/.bash_aliases /root/.bash_aliases
RUN echo "source /autoware/install/setup.bash" > /etc/bash.bashrc
RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc

# Create entrypoint
COPY docker/etc/ros_entrypoint.sh /ros_entrypoint.sh
Expand Down
4 changes: 2 additions & 2 deletions docker/etc/ros_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ GROUP_NAME=${LOCAL_GROUP}
# Check if any of the variables are empty
if [[ -z $USER_ID || -z $USER_NAME || -z $GROUP_ID || -z $GROUP_NAME ]]; then
source "/opt/ros/$ROS_DISTRO/setup.bash"
source /autoware/install/setup.bash
source /opt/autoware/setup.bash
exec "$@"
else
echo "Starting with user: $USER_NAME >> UID $USER_ID, GID: $GROUP_ID"
Expand All @@ -25,7 +25,7 @@ else
# Source ROS2

Check warning on line 25 in docker/etc/ros_entrypoint.sh

View workflow job for this annotation

GitHub Actions / spell-check-differential

Forbidden word (ROS2)
# hadolint ignore=SC1090
source "/opt/ros/$ROS_DISTRO/setup.bash"
source /autoware/install/setup.bash
source /opt/autoware/setup.bash

# Execute the command as the user
exec /usr/sbin/gosu "$USER_NAME" "$@"
Expand Down

0 comments on commit 2befe91

Please sign in to comment.