@@ -22,13 +22,36 @@ set -o pipefail
2222
2323apt-get update --fix-missing
2424
25- # The precompiled caffe dependents on tzdata.
26- # While installing tzdata in docker, we need set the time zone manually,
27- # which will cause the container to hang during installation.
28- # So in order to avoid manually selecting the time zone, set as following:
29- export DEBIAN_FRONTEND=noninteractive
30- apt-get install -y tzdata
25+ # Install dependencies
26+ apt-get install -y --no-install-recommends libboost-filesystem-dev libboost-python-dev \
27+ libboost-system-dev libboost-thread-dev libboost-regex-dev protobuf-compiler \
28+ libprotobuf-dev libhdf5-serial-dev libopenblas-dev libgflags-dev libgoogle-glog-dev
3129
32- apt-get install caffe-cpu -y
30+ # install python packages
31+ pip install " numpy" " protobuf" " scikit-image" " six"
3332
34- pip3 install --upgrade scikit-image
33+ # Build the Caffe and the python wrapper
34+ echo " Downloading Caffe"
35+ CAFFE_HOME=" /opt/caffe"
36+ git clone --branch=ssd --depth 1 https://github.com/weiliu89/caffe /caffe_src
37+ cd /caffe_src
38+
39+ echo " Building Caffe"
40+ mkdir /caffe_src/build && cd /caffe_src/build
41+ cmake .. -DCMAKE_INSTALL_PREFIX=${CAFFE_HOME} -DCMAKE_BUILD_TYPE=Release -DCPU_ONLY=1 \
42+ -Dpython_version=3 -DUSE_OPENCV=OFF -DUSE_LEVELDB=OFF -DUSE_LMDB=OFF -DBUILD_docs=OFF -DBLAS=open
43+ make all -j$( expr $( nproc) - 1)
44+ make pycaffe -j$( expr $( nproc) - 1)
45+ make test -j$( expr $( nproc) - 1)
46+ make runtest -j$( expr $( nproc) - 1)
47+ make pytest -j$( expr $( nproc) - 1)
48+
49+ echo " Installing Caffe to /opt/caffe"
50+ make install
51+
52+ echo " Removing build directory"
53+ cd / && rm -rf /caffe_src
54+
55+ PYCAFFE_ROOT=${CAFFE_HOME} /python
56+ echo " ${CAFFE_HOME} /lib" >> /etc/ld.so.conf.d/caffe.conf && ldconfig
57+ ln -s ${PYCAFFE_ROOT} /caffe /usr/local/lib/python3.6/dist-packages/caffe
0 commit comments