47 lines
1.2 KiB
Plaintext
47 lines
1.2 KiB
Plaintext
# Use the official ROS 2 Humble Desktop image for Ubuntu 22.04
|
|
FROM osrf/ros:humble-desktop
|
|
|
|
# Set environment variables to avoid interactive prompts
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
ENV TZ=UTC
|
|
|
|
# Install essential tools and dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
wget \
|
|
curl \
|
|
python3-pip \
|
|
software-properties-common \
|
|
tmux \
|
|
neovim \
|
|
ros-dev-tools \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python packages for ROS 2 development
|
|
RUN pip3 install --no-cache-dir setuptools colcon-common-extensions
|
|
|
|
# Install additional ROS 2 packages (customize as needed)
|
|
RUN apt-get update && apt-get install -y \
|
|
ros-humble-rqt* \
|
|
ros-humble-xacro \
|
|
ros-humble-joint-state-publisher-gui \
|
|
ros-humble-gazebo-ros-pkgs \
|
|
ros-humble-tf2-tools \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create a non-root user for security
|
|
RUN useradd -m -G sudo -s /bin/bash rosuser && \
|
|
echo "rosuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
|
|
|
# Switch to the non-root user
|
|
USER rosuser
|
|
WORKDIR /home/rosuser
|
|
|
|
# Set up the ROS 2 environment
|
|
RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
|
|
|
|
# Entrypoint script to initialize the environment
|
|
COPY entrypoint.sh /entrypoint.sh
|
|
ENTRYPOINT ["/entrypoint.sh"]
|
|
CMD ["bash"]
|