Commit 5ac8a348 authored by Richard Torenvliet's avatar Richard Torenvliet

docker: Add Docker files and makefile to build and run within Docker

Example command:
$ make && CMD='./targets/fit-model-multi-frame' make run-bash-cmd

The 'make' command will build some of the examples within docker,
and 'make run-bash-cmd' will run the multi-frame example program.
parent a3deb18d
Dockerfile
matlab/*
*.md
build/*
install/*
.git/*
.doc/*
.cmake-build-debug/
# Ignore the user-specific initial_cache file
initial_cache.cmake
targets/*
examples/data/*.mtl
examples/data/*.obj
.idea/*
cmake-build-debug/*
FROM smvanveen/computer-vision:20161109143812
RUN git clone https://ceres-solver.googlesource.com/ceres-solver
RUN (cd ceres-solver; make -j3)
RUN (cd ceres-solver; make install)
#
#
ENV PYTHONPATH=/usr/local/eos/bin/:$PYTHONPATH
#
WORKDIR /libs
RUN git clone https://github.com/pybind/pybind11.git
RUN (cd pybind11; mkdir build; cd build; cmake -DPYBIND11_PYTHON_VERSION=2.7 ..);
RUN (cd pybind11/build; make -j4 && make install);
# extra packages:
# graphviz: for cProfiling using pycallgraph.
# libeigen3-dev: for eos: 3D morphable face model fitting library.
RUN apt-get install -y \
libeigen3-dev \
libgoogle-glog-dev \
libatlas-base-dev \
libeigen3-dev
WORKDIR /eos
ADD 3rdparty /eos
ADD cmake /eos
ADD python /eos
RUN mkdir /data
FROM smvanveen/computer-vision:20161109143812
# extra packages:
# libeigen3-dev: for eos: 3D morphable face model fitting library.
RUN apt-get install -y \
libeigen3-dev \
libgoogle-glog-dev \
libatlas-base-dev \
libeigen3-dev
WORKDIR /libs
RUN git clone https://ceres-solver.googlesource.com/ceres-solver
RUN (cd ceres-solver; mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..)
RUN (cd ceres-solver/build; make -j3; make install)
ENV PYTHONPATH=/usr/local/eos/bin/:$PYTHONPATH
RUN git clone https://github.com/pybind/pybind11.git
RUN (cd pybind11; mkdir build; cd build; cmake -DPYBIND11_PYTHON_VERSION=2.7 ..);
RUN (cd pybind11/build; make -j4 && make install);
WORKDIR /eos
DEBUG:=1
VERSION:=v0.1
IMAGE_TAG:= icyrizard/eos.git:$(VERSION)
DOCKER_FILE:= Dockerfile-dev
HERE:=$(shell pwd)
DOCKER_RUN_FLAGS:= --rm \
--volume $(HERE)/:/eos/ \
--volume $(HERE)/examples/data/:/data/ \
--volume $(HERE)/share/:/data/share/ \
--volume ~/.bash_history:/root/.bash_history \ -e "DEBUG=$(DEBUG)"
BASE_DOCKER_CMD:= docker run $(DOCKER_RUN_FLAGS) $(IMAGE_TAG)
$(info $(TARGETS))
TARGETS:= targets/fit-model \
targets/fit-model-simple \
targets/fit-model-multi-frame
all: $(DEPENDENCIES) $(TARGETS)
OS := $(shell uname)
.PHONY: build
build:
docker build -f $(DOCKER_FILE) -t $(IMAGE_TAG) .
.PHONY: run-bash
run-bash:
docker run --interactive --tty $(DOCKER_RUN_FLAGS) $(IMAGE_TAG) /bin/bash
.PHONY: run-bash-cmd
run-bash-cmd:
docker run --interactive --tty $(DOCKER_RUN_FLAGS) $(IMAGE_TAG) \
/bin/bash -c "$(CMD)"
# TODO create pkg files for the include libraries.
targets/fit-model-multi-frame: examples/fit-model-multi-frame.cpp
mkdir -p $(dir $@)
$(BASE_DOCKER_CMD) /bin/bash -c \
'clang++ -O3 -std=c++14 \
-ggdb \
-I/usr/local/include/pybind11/include/ \
-I/eos/include/ \
-I/eos/3rdparty/glm/ \
-I/eos/3rdparty/eigen3-nnls/ \
-I/eos/3rdparty/cereal-1.1.1/include/ \
-I/eos/3rdparty/eigen3-nnls/src \
-I/eos/3rdparty/nanoflann/include \
-I/usr/local/include/opencv2/ \
-I/usr/include/boost/ \
-I/usr/include/eigen3/ \
-L/usr/lib/x86_64-linux-gnu/ \
-L/usr/local/lib/ \
-lboost_program_options \
-lboost_filesystem \
-lopencv_world \
-lpthread \
-lboost_system \
$^ -o $@'
targets/fit-model-simple: examples/fit-model-simple.cpp
mkdir -p $(dir $@)
$(BASE_DOCKER_CMD) /bin/bash -c \
'clang++ -O3 -std=c++14 \
-ggdb \
-I/usr/local/include/pybind11/include/ \
-I/eos/include/ \
-I/eos/3rdparty/glm/ \
-I/eos/3rdparty/eigen3-nnls/ \
-I/eos/3rdparty/cereal-1.1.1/include/ \
-I/eos/3rdparty/eigen3-nnls/src \
-I/eos/3rdparty/nanoflann/include \
-I/usr/local/include/opencv2/ \
-I/usr/include/boost/ \
-I/usr/include/eigen3/ \
-L/usr/lib/x86_64-linux-gnu/ \
-L/usr/local/lib/ \
-lboost_program_options \
-lboost_filesystem \
-lopencv_world \
-lpthread \
-lboost_system \
$^ -o $@'
targets/fit-model: examples/fit-model.cpp
mkdir -p $(dir $@)
$(BASE_DOCKER_CMD) /bin/bash -c \
'clang++ -ggdb -O3 -std=c++14 \
-I/usr/local/include/pybind11/include/ \
-I/eos/include/ \
-I/eos/3rdparty/glm/ \
-I/eos/3rdparty/eigen3-nnls/ \
-I/eos/3rdparty/cereal-1.1.1/include/ \
-I/eos/3rdparty/eigen3-nnls/src \
-I/eos/3rdparty/nanoflann/include \
-I/usr/local/include/opencv2/ \
-I/usr/include/boost/ \
-I/usr/include/eigen3/ \
-L/usr/lib/x86_64-linux-gnu/ \
-L/usr/local/lib/ \
-lboost_program_options \
-lboost_filesystem \
-lopencv_world \
-lpthread \
$^ -o $@'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment