2024-02-29 13:32:31 +00:00
|
|
|
# Use ROS 2 Humble Hawksbill base image
|
|
|
|
FROM osrf/ros:humble-desktop-full-jammy
|
|
|
|
|
|
|
|
# Update and install dependencies
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
python3-colcon-common-extensions python3-pip \
|
2024-03-25 09:11:43 +00:00
|
|
|
ros-humble-xacro \
|
|
|
|
ros-humble-hardware-interface \
|
|
|
|
ros-humble-controller-interface
|
2024-02-29 13:32:31 +00:00
|
|
|
|
|
|
|
COPY requirements.txt ./
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
|
# Create a workspace
|
|
|
|
WORKDIR /ros2_ws
|
|
|
|
|
|
|
|
# Copy your ROS 2 package into the workspace
|
|
|
|
COPY ./src /ros2_ws/src
|
|
|
|
|
|
|
|
# get all the ros dependencies
|
|
|
|
RUN rosdep update && rosdep install --ignore-src --from-paths src -y
|
|
|
|
|
|
|
|
# remove unnecessary pkgs
|
|
|
|
RUN rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Build your package
|
|
|
|
RUN . /opt/ros/humble/setup.sh && \
|
|
|
|
colcon build
|
|
|
|
|
|
|
|
RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
|
|
|
|
|
|
|
|
ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/ros/humble/bin"
|
|
|
|
|
|
|
|
# Source the workspace
|
|
|
|
CMD ["/bin/bash"]
|