From 5e43f541056c86117f32842fcb71ce0afd8c9e28 Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@gmail.com>
Date: Mon, 18 Feb 2019 09:31:44 +0100
Subject: [PATCH] Pinocchio Dockerfile

---
 docker/pinocchio/Dockerfile | 50 +++++++++++++++++++++++++++++++++++++
 docker/pinocchio/README.md  | 48 +++++++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+)
 create mode 100644 docker/pinocchio/Dockerfile
 create mode 100644 docker/pinocchio/README.md

diff --git a/docker/pinocchio/Dockerfile b/docker/pinocchio/Dockerfile
new file mode 100644
index 0000000..30d37d2
--- /dev/null
+++ b/docker/pinocchio/Dockerfile
@@ -0,0 +1,50 @@
+ARG UBUNTU=bionic
+FROM ubuntu:$UBUNTU
+
+# Setup Robotpkg apt binary repository
+ARG UBUNTU=bionic
+RUN apt-get update -qqy && apt-get install -qqy \
+    build-essential \
+    cmake \
+    curl \
+    git \
+ && echo "deb [arch=amd64] http://robotpkg.openrobots.org/packages/debian/pub $UBUNTU robotpkg" \
+ >> /etc/apt/sources.list.d/robotpkg.list \
+ && curl http://robotpkg.openrobots.org/packages/debian/robotpkg.key | apt-key add - \
+ && rm -rf /var/lib/apt/lists/*
+
+ENV ROBOTPKG_BASE=/opt/openrobots
+ENV CMAKE_PREFIX_PATH=$ROBOTPKG_BASE:$CMAKE_PREFIX_PATH \
+      LD_LIBRARY_PATH=$ROBOTPKG_BASE/lib:$ROBOTPKG_BASE/lib/plugin:$LD_LIBRARY_PATH \
+                 PATH=$ROBOTPKG_BASE/bin:$ROBOTPKG_BASE/sbin:$PATH \
+      PKG_CONFIG_PATH=$ROBOTPKG_BASE/lib/pkgconfig:$PKG_CONFIG_PATH \
+     ROS_PACKAGE_PATH=$ROBOTPKG_BASE/share:$ROS_PACKAGE_PATH
+
+# get Pinocchio dependencies
+ARG PYTHON=python2
+RUN apt-get update -qqy \
+ && apt-get install -qqy \
+    $(echo $PYTHON | sed 's/2//') \
+ && apt-get install -qqy \
+    libeigen3-dev \
+    liburdfdom-dev \
+    libtinyxml-dev \
+    robotpkg-hpp-fcl \
+    robotpkg-py$($PYTHON -V 2>&1 | sed 's/.*\([23]\)\.\([0-9]\).*/\1\2/')-eigenpy \
+ && rm -rf /var/lib/apt/lists/*
+
+# (in)validate docker build cache with the HTTP "Last-Modified" header from github
+ARG NAMESPACE=stack-of-tasks
+ARG BRANCH=devel
+ADD https://github.com/$NAMESPACE/pinocchio/archive/$BRANCH.zip .
+
+# but this zip doesn't come with .git nor submodules
+RUN git clone --recursive --branch $BRANCH https://github.com/$NAMESPACE/pinocchio.git \
+ && mkdir pinocchio/build
+
+WORKDIR /pinocchio/build
+ARG MAKE_JOBS=1
+RUN cmake -DPYTHON_EXECUTABLE=$(which $PYTHON) .. \
+ && make -j$(MAKE_JOBS)
+
+CMD make test
diff --git a/docker/pinocchio/README.md b/docker/pinocchio/README.md
new file mode 100644
index 0000000..4d9a649
--- /dev/null
+++ b/docker/pinocchio/README.md
@@ -0,0 +1,48 @@
+# Pinocchio Dockerfile
+
+If the buildfarm doesn't work in your case, you could use this.
+
+# Build images
+
+```
+docker build -t gepetto/utils:pinocchio-18.04 .
+docker build -t gepetto/utils:pinocchio-16.04 --build-arg UBUNTU=xenial .
+docker build -t gepetto/utils:pinocchio-14.04 --build-arg UBUNTU=trusty .
+docker build -t gepetto/utils:pinocchio-18.04-py3 --build-arg PYTHON=python3 .
+```
+
+# Push images
+
+```
+docker push gepetto/utils:pinocchio-18.04
+docker push gepetto/utils:pinocchio-16.04
+docker push gepetto/utils:pinocchio-14.04
+docker push gepetto/utils:pinocchio-18.04-py3
+```
+
+# Pull an image
+
+```
+docker pull gepetto/utils:pinocchio-18.04
+docker pull gepetto/utils:pinocchio-16.04
+docker pull gepetto/utils:pinocchio-14.04
+docker pull gepetto/utils:pinocchio-18.04-py3
+```
+
+# Run test
+
+```
+docker run --rm -it gepetto/utils:pinocchio-18.04
+docker run --rm -it gepetto/utils:pinocchio-16.04
+docker run --rm -it gepetto/utils:pinocchio-14.04
+docker run --rm -it gepetto/utils:pinocchio-18.04-py3
+```
+
+# Enter in the image
+
+```
+docker run --rm -it gepetto/utils:pinocchio-18.04 bash
+docker run --rm -it gepetto/utils:pinocchio-16.04 bash
+docker run --rm -it gepetto/utils:pinocchio-14.04 bash
+docker run --rm -it gepetto/utils:pinocchio-18.04-py3 bash
+```
-- 
GitLab