installed ros2 tracing

This commit is contained in:
Niklas Halle 2025-04-29 09:31:19 +02:00
parent 4e7c63701a
commit 40a5d3653c
19 changed files with 74617 additions and 75507 deletions

View file

@ -11,6 +11,21 @@ LABEL maintainer="Niklas Halle <niklas@niklashalle.net>"
ENV PIP_BREAK_SYSTEM_PACKAGES=1
ENV DEBIAN_FRONTEND=noninteractive
# User and group IDs
ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
# Set the default shell to bash for RUN commands
# This ensures all RUN commands use bash instead of sh
SHELL ["/bin/bash", "-c"]
@ -30,10 +45,11 @@ RUN apt-get update && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install -y \
python3.10 \
python3.10-venv \
python3.10-dev \
python3.10-distutils \
python3.8 \
python3.8-venv \
python3.8-dev \
python3.8-distutils \
nlohmann-json3-dev \
curl && \
rm -rf /var/lib/apt/lists/*
@ -47,14 +63,14 @@ RUN apt-get update -q && \
# This ensures that ROS 2 commands are available in the shell
# rosdep is a tool for installing system dependencies for ROS packages
RUN rosdep update && \
grep -F "source /opt/ros/${ROS_DISTRO}/setup.bash" /root/.bashrc || echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /root/.bashrc && \
grep -F "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" /root/.bashrc || echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> /root/.bashrc
grep -F "source /opt/ros/${ROS_DISTRO}/setup.bash" /home/dev/.bashrc || echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /home/dev/.bashrc && \
grep -F "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" /home/dev/.bashrc || echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> /home/dev/.bashrc
# Bootstrap pip manually (recommended way)
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
RUN curl -sS https://bootstrap.pypa.io/pip/3.8/get-pip.py | python3.8
# Set Python 3.10 as default Python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# Set Python 3.8 as default Python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
# Install modern nodejs (optional but good practice for JupyterLab widgets)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
@ -63,3 +79,14 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
# Install JupyterLab globally
RUN python3 -m pip install --upgrade jupyterlab
# Install dependencies for ros2_tracing
RUN apt-get update -q && \
apt-get install -y lttng-tools lttng-modules-dkms liblttng-ust-dev
RUN apt-get install -y python3-babeltrace python3-lttng python3-pytest
# Add user to the "tracing" group
RUN usermod -aG tracing $USERNAME
# [Optional] Set the default user. Omit if you want to keep the default as root.
USER $USERNAME