MattClarkson / CMakeCatchTemplate

Template C++ project using CMake, CTest, Catch, and a SuperBuild for dependencies such as Boost, gflags, glog, VTK, OpenCV and PCL.
BSD 3-Clause "New" or "Revised" License
30 stars 13 forks source link

Create our own Docker base image. #49

Closed MattClarkson closed 5 years ago

MattClarkson commented 5 years ago

For this project, we are currently using the opencv-python version of the manylinux docker image from:

DOCKER_IMAGE=quay.io/skvark/manylinux1_$PLAT

which is based on manylinux, with a few additions, such as cmake 3.9.0.

In the longer term though the bigger question is whether we can make a suitable docker image for anything our team is likely to build, such as VTK, OpenCV, PCL, ITK etc.

In general, for people who clone this repo to make their own project, they can also sort out their own docker image, host it on quay.io and install whatever they like in it.

MattClarkson commented 5 years ago

These are my standard Ubuntu build script for getting a Ubuntu 16.04 VM building NifTK.

mkdir build install
sudo apt install doxygen
sudo apt install cmake
sudo apt install git
sudo apt install cmake-curses-gui
sudo apt-get install libbz2-dev
sudo apt-get install libncurses-dev
sudo apt-get install libxt-dev
sudo apt-get install libtiff-dev
sudo apt-get install libwrap0-dev
sudo apt-get install libxext-dev
sudo apt-get install libssl-dev
sudo apt-get install mesa-common-dev
sudo apt-get install libglib2.0-dev
sudo apt-get install libxrender-dev
sudo apt-get install libfontconfig1-dev
sudo apt-get install libxcursor-dev
sudo apt-get install libxft-dev
sudo apt-get install libxi-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libgl-dev
sudo apt-get install libglu-dev
sudo apt-get install qtcreator
sudo apt-get install g++-4.8
sudo apt-get install '^libxcb.*-dev'
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo apt-get install gfortran
sudo apt-get install valgrind
sudo apt-get install python-pip
sudo apt-get install tensorflow
sudo apt-get install niftynet
cd build
cp ~/Downloads/qt-everywhere-opensource-src-4.8.7.tar.gz .
tar -zxvf qt-everywhere-opensource-src-4.8.7.tar.gz
cd qt-everywhere-opensource-src-4.8.7
./configure -prefix /home/niftk/install/qt-4.8.7 -opensource -confirm-license -release -shared -script -openssl -no-phonon -no-phonon-backend -nomake examples -nomake demos -nomake tests
make -j 4
make install
cd ..
echo '# Added for NifTK' >> ~/.bashrc
echo 'export PATH=/home/niftk/install/qt-4.8.7/bin:$PATH' >> ~/.bashrc

So, if we are building just a C++ project, we could use these instructions to setup the Travis Ubuntu host machine.

If we are building wheels on manylinux, then we would need something equivalent inside the docker image, which from memory is Centos based.

MattClarkson commented 5 years ago

So - for Mian - can we configure a new docker image, maybe starting from the opencv one, as opencv is one of the packages we are interested in.

mianasbat commented 5 years ago

@MattClarkson what is your requirement after opencv. Do you want to have all of the above packages in that image?
Following are couple of famous docker images based on open-cv. jjanzic/docker-python3-opencv image containing Python 3.7 and opencv 4.0.0
valian/docker-python-opencv-ffmpeg image containing ffmpeg, opencv3 and python2/3, based on Ubuntu 16.04 LTS .

MattClarkson commented 5 years ago

Specifically, I think we need a manylinux docker image, so we should start with this one: DOCKERIMAGE=quay.io/skvark/manylinux1$PLAT

then we should add those above packages and see if VTK/PCL compile. If not, then we debug, and go from there.

mianasbat commented 5 years ago

I got the above image and ran it on system. It is based on Centos 5.9 which is very old now and it would be a bit difficult to find packages for it. Is there any specific reason for using this image? Would it be fine, if we use Centos 7.4 stable version as base image and your mentioned packages on top of it and then compile VTK/PCL on it.

MattClarkson commented 5 years ago

For now, i've tested VTK, PCL and OpenCV builds with various minimal build options, as part of Issue #51 . So, I think we can leave this for now. At the end of the day, users will have to make their own decision if they are doing python, and want python wheels, and then decide which version of docker to use.

Furthermore, most of the above dependencies are for graphics. So, if you are just doing a library of algorithms you don't need them.