Adds arg to set cartographer version for docker build. (#376)

master
Damon Kohler 2017-06-14 14:44:16 +02:00 committed by GitHub
parent 8140946a34
commit 8a6a2216d2
3 changed files with 15 additions and 13 deletions

View File

@ -14,6 +14,8 @@
FROM ros:indigo FROM ros:indigo
ARG CARTOGRAPHER_VERSION=master
# First, we invalidate the entire cache if googlecartographer/cartographer has # First, we invalidate the entire cache if googlecartographer/cartographer has
# changed. This file's content changes whenever master changes. See: # changed. This file's content changes whenever master changes. See:
# http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone # http://stackoverflow.com/questions/36996046/how-to-prevent-dockerfile-caching-git-clone
@ -23,10 +25,8 @@ ADD https://api.github.com/repos/googlecartographer/cartographer/git/refs/heads/
# wstool needs the updated rosinstall file to clone the correct repos. # wstool needs the updated rosinstall file to clone the correct repos.
COPY cartographer_ros.rosinstall cartographer_ros/ COPY cartographer_ros.rosinstall cartographer_ros/
COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/ COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/
# Remove the contents of the cartographer_ros repo and copy in the updated RUN CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \
# files as necessary. cartographer_ros/scripts/prepare_catkin_workspace.sh
RUN cartographer_ros/scripts/prepare_catkin_workspace.sh && \
rm -rf catkin_ws/src/cartographer_ros/*
# rosdep needs the updated package.xml files to install the correct debs. # rosdep needs the updated package.xml files to install the correct debs.
COPY cartographer_ros/package.xml catkin_ws/src/cartographer_ros/cartographer_ros/ COPY cartographer_ros/package.xml catkin_ws/src/cartographer_ros/cartographer_ros/

View File

@ -14,6 +14,8 @@
FROM ros:kinetic FROM ros:kinetic
ARG CARTOGRAPHER_VERSION=master
# Xenial's base image doesn't ship with sudo. # Xenial's base image doesn't ship with sudo.
RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/*
@ -26,10 +28,8 @@ ADD https://api.github.com/repos/googlecartographer/cartographer/git/refs/heads/
# wstool needs the updated rosinstall file to clone the correct repos. # wstool needs the updated rosinstall file to clone the correct repos.
COPY cartographer_ros.rosinstall cartographer_ros/ COPY cartographer_ros.rosinstall cartographer_ros/
COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/ COPY scripts/prepare_catkin_workspace.sh cartographer_ros/scripts/
# Remove the contents of the cartographer_ros repo and copy in the updated RUN CARTOGRAPHER_VERSION=$CARTOGRAPHER_VERSION \
# files as necessary. cartographer_ros/scripts/prepare_catkin_workspace.sh
RUN cartographer_ros/scripts/prepare_catkin_workspace.sh && \
rm -rf catkin_ws/src/cartographer_ros/*
# rosdep needs the updated package.xml files to install the correct debs. # rosdep needs the updated package.xml files to install the correct debs.
COPY cartographer_ros/package.xml catkin_ws/src/cartographer_ros/cartographer_ros/ COPY cartographer_ros/package.xml catkin_ws/src/cartographer_ros/cartographer_ros/

View File

@ -20,10 +20,12 @@ set -o verbose
. /opt/ros/${ROS_DISTRO}/setup.sh . /opt/ros/${ROS_DISTRO}/setup.sh
# Create a new workspace in 'catkin_ws'. # Create a new workspace in 'catkin_ws'.
mkdir catkin_ws mkdir -p catkin_ws/src
cd catkin_ws cd catkin_ws/src
wstool init src wstool init
# Merge the cartographer_ros.rosinstall file and fetch code for dependencies. # Merge the cartographer_ros.rosinstall file and fetch code for dependencies.
wstool merge -t src ../cartographer_ros/cartographer_ros.rosinstall wstool merge ../../cartographer_ros/cartographer_ros.rosinstall
wstool update -t src wstool set cartographer -v ${CARTOGRAPHER_VERSION} -y
wstool remove cartographer_ros
wstool update