@@ -44,9 +44,10 @@ RUN apt-get -q update \
4444# - Installing blue deps using pip, apt and rosdep
4545# - Installs the remaining blue dependencies from blue_robot.repos
4646# - Installs deps from rosdep for all src dependencies
47- # - colcon build
4847#
49- FROM ci AS robot
48+ # robot_unbuilt **does not** colcon build, to save time
49+ #
50+ FROM ci AS robot_unbuilt
5051
5152#
5253# Ubuntu 24.04 "Noble", which is used as the base image for
@@ -137,16 +138,19 @@ RUN sudo apt-get -q update \
137138 && sudo apt-get clean -y \
138139 && sudo rm -rf /var/lib/apt/lists/*
139140
140- # Actually build workspace
141- RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
142- && colcon build
143-
144- RUN echo "source ${USER_WORKSPACE}/install/setup.bash" >> /home/$USERNAME/.bashrc \
141+ RUN echo "if [ -f ${USER_WORKSPACE}/install/setup.bash ]; then source ${USER_WORKSPACE}/install/setup.bash; fi" >> /home/$USERNAME/.bashrc \
145142 && echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc \
146143 && echo "source $VIRTUAL_ENV/bin/activate" >> /home/$USERNAME/.bashrc \
147144 && echo "\n # Ensure colcon is run in the venv\n alias colcon='python3 -m colcon'" >> /home/$USERNAME/.bashrc
148145
149- FROM robot AS desktop
146+ # Finally, build
147+ FROM robot_unbuilt AS robot
148+
149+ # Actually build workspace
150+ RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
151+ && colcon build
152+
153+ FROM robot_unbuilt AS desktop_unbuilt
150154
151155ENV DEBIAN_FRONTEND=noninteractive
152156ENV GZ_VERSION=harmonic
@@ -223,12 +227,6 @@ RUN sudo apt-get -q update \
223227 && sudo apt-get clean -y \
224228 && sudo rm -rf /var/lib/apt/lists/*
225229
226- # For users that build this on a laptop or system with limited RAM,
227- # Modify the 'colcon build' line to be 'MAKEFLAGS="-j1 -l1" colcon build'
228- # This will limit the amount of RAM that colcon is allowed to use
229- RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
230- && colcon build
231-
232230# Setup the simulation environment variables
233231RUN <<EOT cat >> /home/$USERNAME/.bashrc
234232
@@ -245,6 +243,15 @@ export GZ_SIM_SYSTEM_PLUGIN_PATH=\$HOME/ardupilot_gazebo/build:\$GZ_SIM_SYSTEM_P
245243export GZ_SIM_RESOURCE_PATH=\$ HOME/ardupilot_gazebo/models:\$ HOME/ardupilot_gazebo/worlds:\$ GZ_SIM_RESOURCE_PATH
246244EOT
247245
246+
247+ FROM desktop_unbuilt AS desktop
248+
249+ # For users that build this on a laptop or system with limited RAM,
250+ # Modify the 'colcon build' line to be 'MAKEFLAGS="-j1 -l1" colcon build'
251+ # This will limit the amount of RAM that colcon is allowed to use
252+ RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
253+ && colcon build
254+
248255FROM desktop AS desktop-nvidia
249256
250257# Install NVIDIA software
0 commit comments