Skip to content

Commit

Permalink
add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed May 23, 2020
1 parent 8b112cc commit 35181c5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ARG ROS_DISTRO
ARG UBUNTU_VERSION
FROM osrf/ros:${ROS_DISTRO}-desktop-${UBUNTU_VERSION}

RUN echo "deb http://packages.ros.org/ros-testing/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list
RUN apt-get update && apt-get install -y wget git
RUN wget http://packages.ros.org/ros.key -O - | apt-key add -

RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y \
python-catkin-tools \
python-pip \
python-rosdep \
python-setuptools \
python-wstool

RUN pip install 'pip==9.0.3' && \
pip install 'setuptools==44.1.0'

ARG ROS_DISTRO
RUN cd ~ && \
mkdir -p ros/${ROS_DISTRO}/src && \
cd ros/${ROS_DISTRO}/src && \
wstool init && \
wstool set jsk-ros-pkg/jsk_visualization https://github.com/jsk-ros-pkg/jsk_visualization.git -v master --git -y && \
wstool up -j 2

RUN rosdep update --include-eol-distros

# /opt/ros/${ROS_DISTRO}/share can be changed after rosdep install, so we run it 3 times.
RUN for i in $(seq 3); do rosdep install --rosdistro ${ROS_DISTRO} -r -y -i --from-paths /opt/ros/${ROS_DISTRO}/share ~/ros/${ROS_DISTRO}/src; done

RUN . /opt/ros/${ROS_DISTRO}/setup.sh && \
cd ~/ros/${ROS_DISTRO} && \
catkin build; \
16 changes: 16 additions & 0 deletions docker/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -eu

[[ ${DOCKER_TAG} =~ ([a-z]+)-([0-9a-z.]+)$ ]]
ROS_DISTRO=${BASH_REMATCH[1]};

if [[ ${ROS_DISTRO} = "kinetic" ]]; then
UBUNTU_VERSION="xenial";
elif [[ ${ROS_DISTRO} = "indigo" ]]; then
UBUNTU_VERSION="trusty";
fi

docker build --build-arg ROS_DISTRO=${ROS_DISTRO} \
--build-arg UBUNTU_VERSION=${UBUNTU_VERSION} \
-t ${IMAGE_NAME} .

0 comments on commit 35181c5

Please sign in to comment.