Skip to content

Commit 91e8829

Browse files
authoredAug 22, 2024
feat(docker): install colcon build artifacts to /opt/autoware instead of /autoware/install (autowarefoundation#5117)
1 parent b35b75c commit 91e8829

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed
 

‎docker/Dockerfile

+21-9
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,18 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
100100
&& cat /tmp/rosdep-core-depend-packages.txt | xargs apt-get install -y --no-install-recommends \
101101
&& apt-get autoremove -y && rm -rf "$HOME"/.cache
102102

103-
RUN --mount=type=bind,from=rosdep-depend,source=/autoware/src/core,target=/autoware/src/core \
104-
--mount=type=cache,target=${CCACHE_DIR} \
103+
RUN --mount=type=cache,target=${CCACHE_DIR} \
104+
--mount=type=bind,from=rosdep-depend,source=/autoware/src/core,target=/autoware/src/core \
105105
source /opt/ros/"$ROS_DISTRO"/setup.bash \
106106
&& du -sh ${CCACHE_DIR} && ccache -s \
107107
&& colcon build --cmake-args \
108108
" -Wno-dev" \
109109
" --no-warn-unused-cli" \
110+
--merge-install \
111+
--install-base /opt/autoware \
110112
--mixin release compile-commands ccache \
111-
&& du -sh ${CCACHE_DIR} && ccache -s
113+
&& du -sh ${CCACHE_DIR} && ccache -s \
114+
&& rm -rf /autoware/build
112115

113116
FROM autoware-core AS autoware-universe
114117
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
@@ -125,15 +128,25 @@ RUN --mount=type=ssh \
125128
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache
126129

127130
# Build Autoware
128-
RUN --mount=type=bind,from=rosdep-depend,source=/autoware/src,target=/autoware/src \
129-
--mount=type=cache,target=${CCACHE_DIR} \
131+
# hadolint ignore=SC1091
132+
RUN --mount=type=cache,target=${CCACHE_DIR} \
133+
--mount=type=bind,from=rosdep-depend,source=/autoware/src/launcher,target=/autoware/src/launcher \
134+
--mount=type=bind,from=rosdep-depend,source=/autoware/src/param,target=/autoware/src/param \
135+
--mount=type=bind,from=rosdep-depend,source=/autoware/src/sensor_component,target=/autoware/src/sensor_component \
136+
--mount=type=bind,from=rosdep-depend,source=/autoware/src/sensor_kit,target=/autoware/src/sensor_kit \
137+
--mount=type=bind,from=rosdep-depend,source=/autoware/src/universe,target=/autoware/src/universe \
138+
--mount=type=bind,from=rosdep-depend,source=/autoware/src/vehicle,target=/autoware/src/vehicle \
130139
source /opt/ros/"$ROS_DISTRO"/setup.bash \
140+
&& source /opt/autoware/setup.bash \
131141
&& du -sh ${CCACHE_DIR} && ccache -s \
132142
&& colcon build --cmake-args \
133143
" -Wno-dev" \
134144
" --no-warn-unused-cli" \
145+
--merge-install \
146+
--install-base /opt/autoware \
135147
--mixin release compile-commands ccache \
136-
&& du -sh ${CCACHE_DIR} && ccache -s
148+
&& du -sh ${CCACHE_DIR} && ccache -s \
149+
&& rm -rf /autoware/build
137150

138151
CMD ["/bin/bash"]
139152

@@ -147,7 +160,6 @@ RUN --mount=type=ssh \
147160
&& pip uninstall -y ansible ansible-core \
148161
&& apt-get autoremove -y && rm -rf "$HOME"/.cache
149162

150-
COPY src /autoware/src
151163
# Create entrypoint
152164
COPY docker/etc/ros_entrypoint.sh /ros_entrypoint.sh
153165
RUN chmod +x /ros_entrypoint.sh
@@ -179,11 +191,11 @@ RUN --mount=type=ssh \
179191
/etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/nvidia-docker.list \
180192
/usr/include /usr/share/doc /usr/lib/gcc /usr/lib/jvm /usr/lib/llvm*
181193

182-
COPY --from=autoware-universe /autoware/install/ /autoware/install/
194+
COPY --from=autoware-universe /opt/autoware /opt/autoware
183195

184196
# Copy bash aliases
185197
COPY docker/etc/.bash_aliases /root/.bash_aliases
186-
RUN echo "source /autoware/install/setup.bash" > /etc/bash.bashrc
198+
RUN echo "source /opt/autoware/setup.bash" > /etc/bash.bashrc
187199

188200
# Create entrypoint
189201
COPY docker/etc/ros_entrypoint.sh /ros_entrypoint.sh

‎docker/etc/ros_entrypoint.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ GROUP_NAME=${LOCAL_GROUP}
1010
# Check if any of the variables are empty
1111
if [[ -z $USER_ID || -z $USER_NAME || -z $GROUP_ID || -z $GROUP_NAME ]]; then
1212
source "/opt/ros/$ROS_DISTRO/setup.bash"
13-
source /autoware/install/setup.bash
13+
source /opt/autoware/setup.bash
1414
exec "$@"
1515
else
1616
echo "Starting with user: $USER_NAME >> UID $USER_ID, GID: $GROUP_ID"
@@ -25,7 +25,7 @@ else
2525
# Source ROS2
2626
# hadolint ignore=SC1090
2727
source "/opt/ros/$ROS_DISTRO/setup.bash"
28-
source /autoware/install/setup.bash
28+
source /opt/autoware/setup.bash
2929

3030
# Execute the command as the user
3131
exec /usr/sbin/gosu "$USER_NAME" "$@"

0 commit comments

Comments
 (0)