Dockerfile.kinetic 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. # Copyright 2016 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 ros:kinetic
  15. ARG CARTOGRAPHER_VERSION=master
  16. # Xenial's base image doesn't ship with sudo.
  17. RUN apt-get update && apt-get install -y sudo time && rm -rf /var/lib/apt/lists/*
  18. # First, we invalidate the entire cache if googlecartographer/cartographer has
  19. # changed. This file's content changes whenever master changes. See:
  20. # http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone
  21. ADD https://api.github.com/repos/googlecartographer/cartographer/git/refs/heads/master \
  22. cartographer_ros/cartographer_version.json
  23. # wstool needs the updated rosinstall file to clone the correct repos.
  24. COPY cartographer_ros.rosinstall cartographer_ros/
  25. COPY scripts/prepare_jenkins_catkin_workspace.sh cartographer_ros/scripts/
  26. # Invalidates the Docker cache to ensure this command is always executed.
  27. ARG CACHEBUST=1
  28. RUN CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \
  29. cartographer_ros/scripts/prepare_jenkins_catkin_workspace.sh
  30. # rosdep needs the updated package.xml files to install the correct debs.
  31. COPY cartographer_ros/package.xml catkin_ws/src/cartographer_ros/cartographer_ros/
  32. COPY cartographer_ros_msgs/package.xml catkin_ws/src/cartographer_ros/cartographer_ros_msgs/
  33. COPY cartographer_rviz/package.xml catkin_ws/src/cartographer_ros/cartographer_rviz/
  34. COPY scripts/install_debs.sh cartographer_ros/scripts/
  35. RUN cartographer_ros/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/*
  36. # Install proto3.
  37. RUN /catkin_ws/src/cartographer/scripts/install_proto3.sh
  38. # Build, install, and test all packages individually to allow caching. The
  39. # ordering of these steps must match the topological package ordering as
  40. # determined by Catkin.
  41. COPY scripts/install.sh cartographer_ros/scripts/
  42. COPY scripts/catkin_test_results.sh cartographer_ros/scripts/
  43. COPY cartographer_ros_msgs catkin_ws/src/cartographer_ros/cartographer_ros_msgs/
  44. RUN cartographer_ros/scripts/install.sh --pkg cartographer_ros_msgs && \
  45. cartographer_ros/scripts/install.sh --pkg cartographer_ros_msgs \
  46. --catkin-make-args run_tests && \
  47. cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_ros_msgs
  48. RUN cartographer_ros/scripts/install.sh --pkg ceres-solver
  49. RUN cartographer_ros/scripts/install.sh --pkg cartographer && \
  50. cartographer_ros/scripts/install.sh --pkg cartographer --make-args test
  51. COPY cartographer_ros catkin_ws/src/cartographer_ros/cartographer_ros/
  52. RUN cartographer_ros/scripts/install.sh --pkg cartographer_ros && \
  53. cartographer_ros/scripts/install.sh --pkg cartographer_ros \
  54. --catkin-make-args run_tests && \
  55. cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_ros
  56. COPY cartographer_rviz catkin_ws/src/cartographer_ros/cartographer_rviz/
  57. RUN cartographer_ros/scripts/install.sh --pkg cartographer_rviz && \
  58. cartographer_ros/scripts/install.sh --pkg cartographer_rviz \
  59. --catkin-make-args run_tests && \
  60. cartographer_ros/scripts/catkin_test_results.sh build_isolated/cartographer_rviz
  61. RUN cartographer_ros/scripts/install.sh --pkg cartographer_toru
  62. RUN cartographer_ros/scripts/install.sh --pkg cartographer_fetch
  63. COPY scripts/ros_entrypoint.sh /
  64. # A BTRFS bug may prevent us from cleaning up these directories.
  65. # https://btrfs.wiki.kernel.org/index.php/Problem_FAQ#I_cannot_delete_an_empty_directory
  66. RUN rm -rf cartographer_ros catkin_ws || true
  67. RUN sudo apt-get update
  68. RUN sudo apt-get -y install openjdk-8-jdk python-pip
  69. ENV HOME /home/jenkins
  70. RUN addgroup --system --gid 10000 jenkins
  71. RUN adduser --system --ingroup jenkins --home $HOME --uid 10000 jenkins
  72. LABEL Description="This is a base image, which provides the Jenkins agent executable (slave.jar)" Vendor="Jenkins project" Version="3.17"
  73. ARG VERSION=3.17
  74. ARG AGENT_WORKDIR=/home/jenkins/agent
  75. RUN curl --create-dirs -sSLo /usr/share/jenkins/slave.jar https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar \
  76. && chmod 755 /usr/share/jenkins \
  77. && chmod 644 /usr/share/jenkins/slave.jar
  78. # USER jenkins
  79. ENV AGENT_WORKDIR=${AGENT_WORKDIR}
  80. RUN mkdir /home/jenkins/.jenkins && mkdir -p ${AGENT_WORKDIR}
  81. VOLUME /home/jenkins/.jenkins
  82. VOLUME ${AGENT_WORKDIR}
  83. WORKDIR /home/jenkins
  84. COPY jenkins/jenkins-slave /usr/local/bin/jenkins-slave
  85. ENV CLOUDSDK_CORE_DISABLE_PROMPTS 1
  86. ENV PATH /opt/google-cloud-sdk/bin:$PATH
  87. USER root
  88. # Install Google Cloud Components
  89. RUN curl https://sdk.cloud.google.com | bash && mv google-cloud-sdk /opt
  90. RUN gcloud components install kubectl
  91. RUN pip install --upgrade google-cloud-datastore
  92. RUN pip install --upgrade google-cloud-bigquery
  93. COPY jenkins/worker.py /worker.py
  94. # USER root
  95. ENTRYPOINT ["jenkins-slave"]