From 3f7a7f59845101afc5ba0a68ea679533289eb810 Mon Sep 17 00:00:00 2001 From: Niko Date: Thu, 29 Feb 2024 14:32:31 +0100 Subject: [PATCH] added docker --- Dockerfile | 33 +++++++++++++++++++++++++++++++++ docker-compose.yaml | 14 ++++++++++++++ requirements.txt | 3 +++ 3 files changed, 50 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yaml create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a0b2b4d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# 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 \ + ros-humble-xacro + +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"] diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..2789079 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,14 @@ +version: '3.8' +services: + ros2: + build: . + volumes: + - ./src:/ros2_ws/src + networks: + - ros_network + tty: true + stdin_open: true + +networks: + ros_network: + driver: bridge diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c0af066 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pytest~=6.2.5 +PyYAML~=5.4.1 +setuptools~=58.2.0 \ No newline at end of file