From 79c9d737b6606e7d880a1be8ad030d2c1d089c7b Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Fri, 2 Feb 2024 22:07:49 -0700 Subject: [PATCH 1/5] Add dockerfile for rolling Signed-off-by: Ryan Friedman --- Dockerfile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..b38b077d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +ARG ROS_DISTRO=rolling +FROM ros:${ROS_DISTRO}-ros-core + +RUN apt-get update \ + && apt-get install -y \ + ros-dev-tools \ + wget + +WORKDIR /root/ros2_ws/ +RUN mkdir -p src +COPY tools/ros2_dependencies.repos . +RUN vcs import --input ros2_dependencies.repos src +RUN rosdep init + +COPY . src/grid_map +RUN ls src/grid_map + +SHELL ["/bin/bash", "-c"] +RUN apt-get update \ + && rosdep update + +RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ + && rosdep install -y --ignore-src --from-paths src --skip-keys slam_toolbox + +RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ + && colcon build --symlink-install --packages-up-to grid_map + From f4eba307abc7f910b4def200d89523b01895cdbb Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Fri, 2 Feb 2024 22:54:28 -0700 Subject: [PATCH 2/5] Add dockerignore Signed-off-by: Ryan Friedman --- .dockerignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..a0d66b16 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.circleci/ +.github/ +.gitignore/ +LICENSE/ +README.md \ No newline at end of file From 11755500725153ea432cc879508f2917f1ca0b4b Mon Sep 17 00:00:00 2001 From: Ryan Friedman Date: Fri, 2 Feb 2024 23:29:29 -0700 Subject: [PATCH 3/5] Improve multi-stage perfomance and avoid cache-busting Signed-off-by: Ryan Friedman --- Dockerfile | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index b38b077d..b8b3e973 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,36 @@ ARG ROS_DISTRO=rolling FROM ros:${ROS_DISTRO}-ros-core -RUN apt-get update \ - && apt-get install -y \ - ros-dev-tools \ - wget - WORKDIR /root/ros2_ws/ -RUN mkdir -p src + +# Install essential dependencies +RUN apt-get update && \ + apt-get install -y \ + ros-dev-tools \ + wget && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# Clone dependencies COPY tools/ros2_dependencies.repos . -RUN vcs import --input ros2_dependencies.repos src +RUN mkdir -p src && \ + vcs import --input ros2_dependencies.repos src + +# Initialize rosdep RUN rosdep init +# Copy source code COPY . src/grid_map -RUN ls src/grid_map +# Install dependencies SHELL ["/bin/bash", "-c"] -RUN apt-get update \ - && rosdep update - -RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ - && rosdep install -y --ignore-src --from-paths src --skip-keys slam_toolbox - -RUN source /opt/ros/${ROS_DISTRO}/setup.bash \ - && colcon build --symlink-install --packages-up-to grid_map +RUN apt-get update && \ + rosdep update && \ + source /opt/ros/${ROS_DISTRO}/setup.bash && \ + rosdep install -y --ignore-src --from-paths src --skip-keys slam_toolbox && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* +# Build +RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \ + colcon build --symlink-install --packages-up-to grid_map From d067502e272ba88ac804a40bdab93d5a70d00cab Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 5 Feb 2024 08:31:08 -0700 Subject: [PATCH 4/5] Ignore gazebo classic sources Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b8b3e973..0ee0be8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ SHELL ["/bin/bash", "-c"] RUN apt-get update && \ rosdep update && \ source /opt/ros/${ROS_DISTRO}/setup.bash && \ - rosdep install -y --ignore-src --from-paths src --skip-keys slam_toolbox && \ + rosdep install -y --ignore-src --from-paths src --skip-keys slam_toolbox --skip-keys gazebo_ros_pkgs --skip-keys turtlebot3_gazebo && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* From f13b648e3fd179b5fe24415ba8957efd4a5a6382 Mon Sep 17 00:00:00 2001 From: Ryan Date: Mon, 5 Feb 2024 08:31:21 -0700 Subject: [PATCH 5/5] Add missing newline in .dockerignore Co-authored-by: Daisuke Nishimatsu <42202095+wep21@users.noreply.github.com> --- .dockerignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index a0d66b16..b7972978 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,4 +2,4 @@ .github/ .gitignore/ LICENSE/ -README.md \ No newline at end of file +README.md