Skip to content

Commit 5020803

Browse files
committed
2 parents fb1d847 + c4675d3 commit 5020803

File tree

9 files changed

+87
-45
lines changed

9 files changed

+87
-45
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: 68 additions & 28 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,48 +142,58 @@ 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

119151
ENV DEBIAN_FRONTEND=noninteractive
120-
ENV GZ_VERSION=garden
121-
122-
# Install Gazebo Garden: https://gazebosim.org/docs/garden/install_ubuntu
123-
RUN sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
124-
&& 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 \
125-
&& sudo apt-get -q update \
126-
&& sudo apt-get -y --quiet --no-install-recommends install \
127-
gz-garden \
128-
&& sudo apt-get autoremove -y \
129-
&& sudo apt-get clean -y \
130-
&& sudo rm -rf /var/lib/apt/lists/*
131-
132-
# Install ArduPilot and ardupilot_gazebo dependencies
133-
RUN sudo apt-get -q update \
134-
&& sudo apt-get -q -y upgrade \
135-
&& sudo apt-get -q install --no-install-recommends -y \
152+
ENV GZ_VERSION=harmonic
153+
154+
# Install Gazebo Harmonic: https://gazebosim.org/docs/harmonic/install_ubuntu
155+
# Per DL3004, use "USER root" rather than "sudo"
156+
# https://github.com/hadolint/hadolint/wiki/DL3004
157+
USER root
158+
# Install custom rosdep list
159+
ADD --chown=root:root --chmod=0644 https://raw.githubusercontent.com/osrf/osrf-rosdep/master/gz/00-gazebo.list /etc/ros/rosdep/sources.list.d/00-gazebo.list
160+
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
161+
&& 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 \
162+
&& apt-get -q update \
163+
&& apt-get -y --quiet --no-install-recommends install \
164+
cppzmq-dev \
165+
gz-${GZ_VERSION} \
166+
python3-pexpect \
136167
python3-wxgtk4.0 \
168+
python3-future \
137169
rapidjson-dev \
138170
xterm \
139-
libgz-sim7-dev \
140171
rapidjson-dev \
141172
libopencv-dev \
142-
&& sudo apt-get autoremove -y \
143-
&& sudo apt-get clean -y \
144-
&& sudo rm -rf /var/lib/apt/lists/*
173+
&& apt-get autoremove -y \
174+
&& apt-get clean -y \
175+
&& rm -rf /var/lib/apt/lists/*
176+
USER $USERNAME
145177

146178
# Clone ArduSub
147179
# ArduSub is installed for simulation purposes ONLY
148180
# When deployed onto hardware, the native installation of ArduSub
149181
# (on the FCU) will be used.
150182
WORKDIR /home/$USERNAME
151-
RUN git clone https://github.com/ArduPilot/ardupilot.git --recurse-submodules
183+
# Really should do version pinning but Sub-4.5 is waaaay behind master
184+
# (e.g. it doesn't know about "noble" yet)
185+
ARG ARDUPILOT_RELEASE=master
186+
RUN git clone -b ${ARDUPILOT_RELEASE} https://github.com/ArduPilot/ardupilot.git --recurse-submodules
152187

153188
# Install ArduSub dependencies
154189
WORKDIR /home/$USERNAME/ardupilot
155190
ENV SKIP_AP_EXT_ENV=1 SKIP_AP_GRAPHIC_ENV=1 SKIP_AP_COV_ENV=1 SKIP_AP_GIT_CHECK=1
156-
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
157197

158198
# Build ArduSub
159199
WORKDIR /home/$USERNAME/ardupilot

.github/workflows/docker.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }}
5050
5151
- name: Build and push Docker image
52-
uses: docker/build-push-action@v6.5.0
52+
uses: docker/build-push-action@v6.6.1
5353
with:
5454
context: .
5555
file: .docker/Dockerfile
@@ -96,7 +96,7 @@ jobs:
9696
type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }}
9797
9898
- name: Build and push Docker image
99-
uses: docker/build-push-action@v6.5.0
99+
uses: docker/build-push-action@v6.6.1
100100
with:
101101
context: .
102102
file: .docker/Dockerfile
@@ -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:
@@ -138,7 +139,7 @@ jobs:
138139
type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }}
139140
140141
- name: Build and push Docker image
141-
uses: docker/build-push-action@v6.5.0
142+
uses: docker/build-push-action@v6.6.1
142143
with:
143144
context: .
144145
file: .docker/Dockerfile
@@ -179,7 +180,7 @@ jobs:
179180
type=raw,value=${{ matrix.ROS_DISTRO }}-${{ github.job }}
180181
181182
- name: Build and push Docker image
182-
uses: docker/build-push-action@v6.5.0
183+
uses: docker/build-push-action@v6.6.1
183184
with:
184185
context: .
185186
file: .docker/Dockerfile

.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)