# Set the ROS distribution as an argument, defaulting to 'jazzy' ARG ROS_DISTRO=foxy # You can find available ROS images here: https://hub.docker.com/_/ros/tags FROM osrf/ros:${ROS_DISTRO}-desktop # Set the maintainer information for this Dockerfile LABEL maintainer="Niklas Halle " # Set environment variables ENV PIP_BREAK_SYSTEM_PACKAGES=1 ENV DEBIAN_FRONTEND=noninteractive # Set the default shell to bash for RUN commands # This ensures all RUN commands use bash instead of sh SHELL ["/bin/bash", "-c"] # Update the system and install essential tools # This step upgrades all packages and installs utilities needed for development RUN apt-get update -q && \ apt-get upgrade -yq && \ apt-get install -yq --no-install-recommends \ apt-utils wget curl git build-essential vim sudo \ lsb-release locales bash-completion tzdata gosu \ gedit htop nano libserial-dev ninja-build clang-18 # Update packages and install dependencies RUN apt-get update && \ apt-get install -y software-properties-common curl build-essential && \ add-apt-repository ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y \ python3.10 \ python3.10-venv \ python3.10-dev \ python3.10-distutils \ curl && \ rm -rf /var/lib/apt/lists/* # Install additional tools required for ROS 2 development # These packages help with building and managing ROS 2 workspaces RUN apt-get update -q && \ apt-get install -y gnupg2 iputils-ping usbutils \ python3-argcomplete python3-colcon-common-extensions python3-networkx python3-pip python3-rosdep python3-vcstool # Set up the ROS 2 environment # 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 # Bootstrap pip manually (recommended way) RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10 # Set Python 3.10 as default Python3 RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 # Install modern nodejs (optional but good practice for JupyterLab widgets) RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ apt-get install -y nodejs && \ npm install -g npm # Install JupyterLab globally RUN python3 -m pip install --upgrade jupyterlab