Dockerfile.noetic 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # Copyright 2020 The Cartographer Authors
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. FROM osrf/ros:noetic-desktop
  15. ARG CARTOGRAPHER_VERSION=master
  16. # We require a GitHub access token to be passed.
  17. ARG github_token
  18. # Prevent any interaction required by apt-get.
  19. # https://stackoverflow.com/questions/22466255
  20. ARG DEBIAN_FRONTEND=noninteractive
  21. # ROS Noetic's base image doesn't ship with sudo and git.
  22. RUN apt-get update && apt-get install -y sudo git
  23. # First, we invalidate the entire cache if cartographer-project/cartographer has
  24. # changed. This file's content changes whenever master changes. See:
  25. # http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone
  26. ADD https://api.github.com/repos/cartographer-project/cartographer/git/refs/heads/master?access_token=$github_token \
  27. cartographer_ros/cartographer_version.json
  28. # wstool needs the updated rosinstall file to clone the correct repos.
  29. COPY cartographer_ros.rosinstall cartographer_ros/
  30. COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/
  31. RUN CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \
  32. cartographer_ros/scripts/prepare_catkin_workspace.sh
  33. # rosdep needs the updated package.xml files to install the correct debs.
  34. COPY cartographer_ros/package.xml catkin_ws/src/cartographer_ros/cartographer_ros/
  35. COPY cartographer_ros_msgs/package.xml catkin_ws/src/cartographer_ros/cartographer_ros_msgs/
  36. COPY cartographer_rviz/package.xml catkin_ws/src/cartographer_ros/cartographer_rviz/
  37. COPY scripts/install_debs.sh cartographer_ros/scripts/
  38. RUN cartographer_ros/scripts/install_debs.sh
  39. # Install Abseil.
  40. RUN /catkin_ws/src/cartographer/scripts/install_abseil.sh
  41. # Build, install, and test all packages individually to allow caching. The
  42. # ordering of these steps must match the topological package ordering as
  43. # determined by Catkin.
  44. COPY scripts/install.sh cartographer_ros/scripts/
  45. COPY scripts/catkin_test_results.sh cartographer_ros/scripts/
  46. RUN cartographer_ros/scripts/install.sh --pkg cartographer && \
  47. cartographer_ros/scripts/install.sh --pkg cartographer --make-args test
  48. COPY cartographer_ros_msgs catkin_ws/src/cartographer_ros/cartographer_ros_msgs/
  49. RUN cartographer_ros/scripts/install.sh --pkg cartographer_ros_msgs && \
  50. cartographer_ros/scripts/install.sh --pkg cartographer_ros_msgs \
  51. --catkin-make-args run_tests && \
  52. cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_ros_msgs
  53. COPY cartographer_ros catkin_ws/src/cartographer_ros/cartographer_ros/
  54. RUN cartographer_ros/scripts/install.sh --pkg cartographer_ros && \
  55. cartographer_ros/scripts/install.sh --pkg cartographer_ros \
  56. --catkin-make-args run_tests && \
  57. cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_ros
  58. COPY cartographer_rviz catkin_ws/src/cartographer_ros/cartographer_rviz/
  59. RUN cartographer_ros/scripts/install.sh --pkg cartographer_rviz && \
  60. cartographer_ros/scripts/install.sh --pkg cartographer_rviz \
  61. --catkin-make-args run_tests && \
  62. cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_rviz
  63. COPY scripts/ros_entrypoint.sh /
  64. RUN rm -rf /var/lib/apt/lists/*
  65. # A BTRFS bug may prevent us from cleaning up these directories.
  66. # https://btrfs.wiki.kernel.org/index.php/Problem_FAQ#I_cannot_delete_an_empty_directory
  67. RUN rm -rf cartographer_ros catkin_ws || true