Skip to content

Commit fe3861d

Browse files
authored
Rolling ROS image is now based on "noble" (#220)
* Update to use Harmonic * Update main Dockerfile for "noble" base images: - Use the provided user "ubuntu" at UID 1000 - Use a venv for user-installed python packages * Add "third-party" rosdep from OSRF for gazebo deps. * Install cppzmq-dev for Gazebo * Allow pushing to apl-ocean-engineering * Build mavros from source. * Build mavros from source, with patch to fix yaml-cpp linkage * ardupilot script should not activate venv by default. Activate blue venv instead. * Reverse change in docker.yaml action. * Insert comment before arduplot additions to .bashrc * Update username in .devcontainer/ * Replace patches for mavros/mavlink with sed one-liners. * Extend Docker build timeout in github actions to allow for extended arm64 build times. * timeout_minutes should be at job level? * Disabled arm64 build for "robot" Also: * Set python in venv as default Python in dev container * Remove build timeout in github action (which was ignored) * Correctly disable arm64 build. --------- Co-authored-by: Aaron Marburg <amarburg@uw.edu>
1 parent 8a4e05a commit fe3861d

File tree

9 files changed

+60
-20
lines changed

9 files changed

+60
-20
lines changed

.devcontainer/nouveau/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ghcr.io/robotic-decision-making-lab/blue:rolling-desktop
33
# Install ROS dependencies
44
# This is done in a previous stage, but we include it again here in case anyone wants to
55
# add new dependencies during development
6-
ENV USERNAME=blue
6+
ENV USERNAME=ubuntu
77
ENV USER_WORKSPACE=/home/$USERNAME/ws_blue
88
WORKDIR $USER_WORKSPACE
99

.devcontainer/nouveau/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "Nouveau Dev Container",
33
"dockerFile": "Dockerfile",
44
"context": "../..",
5-
"workspaceMount": "source=${localWorkspaceFolder},target=/home/blue/ws_blue/src/blue,type=bind",
6-
"workspaceFolder": "/home/blue/ws_blue/src/blue",
7-
"remoteUser": "blue",
5+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/ws_blue/src/blue,type=bind",
6+
"workspaceFolder": "/home/ubuntu/ws_blue/src/blue",
7+
"remoteUser": "ubuntu",
88
"runArgs": [
99
"--network=host",
1010
"--cap-add=SYS_PTRACE",

.devcontainer/nvidia/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ FROM ghcr.io/robotic-decision-making-lab/blue:rolling-desktop-nvidia
33
# Install ROS dependencies
44
# This is done in a previous stage, but we include it again here in case anyone wants to
55
# add new dependencies during development
6-
ENV USERNAME=blue
6+
ENV USERNAME=ubuntu
77
ENV USER_WORKSPACE=/home/$USERNAME/ws_blue
88
WORKDIR $USER_WORKSPACE
99

.devcontainer/nvidia/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "NVIDIA Dev Container",
33
"dockerFile": "Dockerfile",
44
"context": "../..",
5-
"workspaceMount": "source=${localWorkspaceFolder},target=/home/blue/ws_blue/src/blue,type=bind",
6-
"workspaceFolder": "/home/blue/ws_blue/src/blue",
7-
"remoteUser": "blue",
5+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/ws_blue/src/blue,type=bind",
6+
"workspaceFolder": "/home/ubuntu/ws_blue/src/blue",
7+
"remoteUser": "ubuntu",
88
"runArgs": [
99
"--network=host",
1010
"--cap-add=SYS_PTRACE",

.devcontainer/robot/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ FROM ${BLUE_GITHUB_REPO}:${ROS_DISTRO}-robot
88
# Install ROS dependencies
99
# This is done in a previous stage, but we include it again here in case anyone wants to
1010
# add new dependencies during development
11-
ENV USERNAME=blue
11+
ENV USERNAME=ubuntu
1212
ENV USER_WORKSPACE=/home/$USERNAME/ws_blue
1313
WORKDIR $USER_WORKSPACE
1414

.devcontainer/robot/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"ROS_DISTRO": "rolling"
99
}
1010
},
11-
"workspaceMount": "source=${localWorkspaceFolder},target=/home/blue/ws_blue/src/blue,type=bind",
12-
"workspaceFolder": "/home/blue/ws_blue/src/blue",
13-
"remoteUser": "blue",
11+
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/ws_blue/src/blue,type=bind",
12+
"workspaceFolder": "/home/ubuntu/ws_blue/src/blue",
13+
"remoteUser": "ubuntu",
1414
"runArgs": [
1515
"--network=host",
1616
"--cap-add=SYS_PTRACE",

.docker/Dockerfile

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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 \
@@ -47,14 +48,14 @@ RUN apt-get -q update \
4748
#
4849
FROM ci AS robot
4950

50-
# Configure a new non-root user
51-
ARG USERNAME=blue
51+
#
52+
# Ubuntu 24.04 "Noble", which is used as the base image for
53+
# jazzy and rolling images, now includes a user "ubuntu" at UID 1000
54+
ARG USERNAME=ubuntu
5255
ARG USER_UID=1000
5356
ARG USER_GID=$USER_UID
5457

55-
RUN groupadd --gid $USER_GID $USERNAME \
56-
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
57-
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
58+
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
5859
&& chmod 0440 /etc/sudoers.d/$USERNAME \
5960
&& usermod -a -G dialout $USERNAME \
6061
&& echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc
@@ -65,6 +66,16 @@ ENV DEBIAN_FRONTEND=noninteractive
6566
USER $USERNAME
6667
ENV USER=$USERNAME
6768

69+
# Python in Ubuntu is now marked as a "Externally managed environment",
70+
# Per best practice, create a venv for local python packages
71+
#
72+
# These two ENVs effectively "activate" the venv for subsequent calls to
73+
# python/pip in the Dockerfile
74+
WORKDIR /home/$USERNAME
75+
ENV VIRTUAL_ENV=/home/$USERNAME/.venv/blue
76+
RUN python3 -m venv --system-site-packages --symlinks $VIRTUAL_ENV
77+
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
78+
6879
# Install MAVROS dependencies
6980
WORKDIR /home/$USERNAME
7081
RUN wget https://raw.githubusercontent.com/mavlink/mavros/ros2/mavros/scripts/install_geographiclib_datasets.sh \
@@ -97,6 +108,25 @@ RUN sudo apt-get -q update \
97108
&& sudo apt-get clean -y \
98109
&& sudo rm -rf /var/lib/apt/lists/*
99110

111+
# Manually install MAVROS from source in the ws_blue/ workspace
112+
WORKDIR $USER_WORKSPACE/src/
113+
ARG MAVROS_RELEASE=ros2
114+
ARG MAVLINK_RELEASE=release/rolling/mavlink
115+
RUN git clone --depth 1 -b ${MAVROS_RELEASE} https://github.com/mavlink/mavros.git
116+
RUN git clone --depth 1 --recursive -b ${MAVLINK_RELEASE} https://github.com/mavlink/mavlink-gbp-release.git mavlink
117+
# - mavgen uses future.standard_library for backwards compatibility with Python2;
118+
# However, this caused issues with Python 3.12 installed in "noble".
119+
# Comment those lines out in mavlink.
120+
#
121+
# - Fix linkage for yaml-cpp in mavros_extra_plugins
122+
RUN sed -i -e 's/^from future import standard_library/#from future import standard_library/' \
123+
-e 's/standard_library.install_aliases()/#standard_library.install_aliases()/' \
124+
mavlink/pymavlink/generator/mavgen.py && \
125+
sed -i -e 's/^# find_package(yaml_cpp REQUIRED)/find_package(yaml-cpp REQUIRED)/' \
126+
-e '/^ament_target_dependencies(mavros_extras_plugins$/i target_link_libraries(mavros_extras_plugins yaml-cpp::yaml-cpp)' \
127+
-e '/^ament_target_dependencies(mavros_extras$/i target_link_libraries(mavros_extras yaml-cpp::yaml-cpp)' \
128+
mavros/mavros_extras/CMakeLists.txt
129+
100130
WORKDIR $USER_WORKSPACE
101131
RUN sudo apt-get -q update \
102132
&& sudo apt-get -q -y upgrade \
@@ -112,7 +142,9 @@ RUN . "/opt/ros/${ROS_DISTRO}/setup.sh" \
112142
&& colcon build
113143

114144
RUN echo "source ${USER_WORKSPACE}/install/setup.bash" >> /home/$USERNAME/.bashrc \
115-
&& echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc
145+
&& echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/$USERNAME/.bashrc \
146+
&& echo "source $VIRTUAL_ENV/bin/activate" >> /home/$USERNAME/.bashrc \
147+
&& echo "\n# Ensure colcon is run in the venv\nalias colcon='python3 -m colcon'" >> /home/$USERNAME/.bashrc
116148

117149
FROM robot AS desktop
118150

@@ -129,6 +161,7 @@ RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pk
129161
&& 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" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \
130162
&& apt-get -q update \
131163
&& apt-get -y --quiet --no-install-recommends install \
164+
cppzmq-dev \
132165
gz-${GZ_VERSION} \
133166
python3-pexpect \
134167
python3-wxgtk4.0 \
@@ -155,7 +188,12 @@ RUN git clone -b ${ARDUPILOT_RELEASE} https://github.com/ArduPilot/ardupilot.git
155188
# Install ArduSub dependencies
156189
WORKDIR /home/$USERNAME/ardupilot
157190
ENV SKIP_AP_EXT_ENV=1 SKIP_AP_GRAPHIC_ENV=1 SKIP_AP_COV_ENV=1 SKIP_AP_GIT_CHECK=1
158-
RUN Tools/environment_install/install-prereqs-ubuntu.sh -y
191+
# Do not install the STM development tools
192+
ENV DO_AP_STM_ENV=0
193+
# Do not activate the Ardupilot venv by default
194+
ENV DO_PYTHON_VENV_ENV=0
195+
RUN echo "\n# Below from ardupilot script \"install-prereqs-ubuntu.sh\"\n" >> /home/$USERNAME/.bashrc && \
196+
Tools/environment_install/install-prereqs-ubuntu.sh -y
159197

160198
# Build ArduSub
161199
WORKDIR /home/$USERNAME/ardupilot

.github/workflows/docker.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ jobs:
105105
tags: ${{ steps.meta.outputs.tags }}
106106
labels: ${{ steps.meta.outputs.labels }}
107107
push: ${{ env.PUSH }}
108-
platforms: linux/amd64,linux/arm64
108+
platforms: linux/amd64
109+
#platforms: linux/amd64,linux/arm64
109110

110111
desktop:
111112
strategy:

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
},
4343
"editor.defaultFormatter": "charliermarsh.ruff"
4444
},
45+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/blue/bin/python",
4546
"[dockerfile]": {
4647
"editor.quickSuggestions": {
4748
"strings": true

0 commit comments

Comments
 (0)