@@ -18,6 +18,7 @@ RUN apt-get -q update \
1818 clang-tools \
1919 python3-pip \
2020 python3-dev \
21+ python3-venv \
2122 lsb-release \
2223 wget \
2324 gnupg \
@@ -39,13 +40,11 @@ RUN apt-get -q update \
3940FROM ci AS robot
4041
4142# Configure a new non-root user
42- ARG USERNAME=blue
43+ ARG USERNAME=ubuntu
4344ARG USER_UID=1000
4445ARG USER_GID=$USER_UID
4546
46- RUN groupadd --gid $USER_GID $USERNAME \
47- && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
48- && echo $USERNAME ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
47+ RUN echo $USERNAME ALL=\( root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
4948 && chmod 0440 /etc/sudoers.d/$USERNAME \
5049 && usermod -a -G dialout $USERNAME \
5150 && echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc
@@ -56,6 +55,17 @@ ENV DEBIAN_FRONTEND=noninteractive
5655USER $USERNAME
5756ENV USER=$USERNAME
5857
58+ # Python in Ubuntu is now marked as a "Externally managed environment",
59+ # Per best practice, create a venv for local python packages
60+ # Is there a more elegant way to handle this?
61+ #
62+ # These two ENVs effectively "activate" the venv for subsequent calls to
63+ # python/pip in the Dockerfile
64+ WORKDIR /home/$USERNAME
65+ ENV VIRTUAL_ENV=/home/$USERNAME/.venv/blue
66+ RUN python3 -m venv --system-site-packages --symlinks $VIRTUAL_ENV
67+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
68+
5969# Install MAVROS dependencies
6070WORKDIR /home/$USERNAME
6171RUN wget https://raw.githubusercontent.com/mavlink/mavros/ros2/mavros/scripts/install_geographiclib_datasets.sh \
@@ -97,19 +107,25 @@ RUN sudo apt-get -q update \
97107 && sudo rm -rf /var/lib/apt/lists/*
98108
99109RUN echo "source ${USER_WORKSPACE}/install/setup.bash" >> /home/$USERNAME/.bashrc \
100- && echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc
110+ && echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc \
111+ && echo "\n # Ensure colcon is run in the venv\n alias colcon='python3 -m colcon'" >> /home/$USERNAME/.bashrc
101112
102113FROM robot AS desktop
103114
104115ENV DEBIAN_FRONTEND=noninteractive
105- ENV GZ_VERSION=garden
106-
107- # Install Gazebo Garden: https://gazebosim.org/docs/garden/install_ubuntu
116+ ENV GZ_VERSION=harmonic
117+
118+ # Gazebo Binary availability:
119+ # Humble: Garden
120+ # Iron: Garden
121+ # Jazzy: Harmonic
122+ # Rolling: Harmonic
123+ # Install Gazebo Harmonic: https://gazebosim.org/docs/harmonic/install_ubuntu
108124RUN sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
109125 && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \
110126 && sudo apt-get -q update \
111127 && sudo apt-get -y --quiet --no-install-recommends install \
112- gz-garden \
128+ gz-${GZ_VERSION} \
113129 && sudo apt-get autoremove -y \
114130 && sudo apt-get clean -y \
115131 && sudo rm -rf /var/lib/apt/lists/*
@@ -118,11 +134,14 @@ RUN sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrin
118134RUN sudo apt-get -q update \
119135 && sudo apt-get -q -y upgrade \
120136 && sudo apt-get -q install --no-install-recommends -y \
137+ python3-pexpect \
121138 python3-wxgtk4.0 \
139+ python3-future \
122140 rapidjson-dev \
123141 xterm \
124- libgz-sim7 -dev \
142+ libgz-sim? -dev \
125143 rapidjson-dev \
144+ cppzmq-dev \
126145 libopencv-dev \
127146 && sudo apt-get autoremove -y \
128147 && sudo apt-get clean -y \
@@ -133,7 +152,10 @@ RUN sudo apt-get -q update \
133152# When deployed onto hardware, the native installation of ArduSub
134153# (on the FCU) will be used.
135154WORKDIR /home/$USERNAME
136- RUN git clone https://github.com/ArduPilot/ardupilot.git --recurse-submodules
155+ # Really should do version pinning but Sub-4.5 is waaaay behind master
156+ # (doesn't know about "noble" yet)
157+ ARG ARDUPILOT_RELEASE=master
158+ RUN git clone -b ${ARDUPILOT_RELEASE} https://github.com/ArduPilot/ardupilot.git --recurse-submodules
137159
138160# Install ArduSub dependencies
139161WORKDIR /home/$USERNAME/ardupilot
0 commit comments