Skip to content

Instantly share code, notes, and snippets.

@danlamanna
Created February 27, 2018 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danlamanna/de2f8a35f33d3a3d22b24196534f2af5 to your computer and use it in GitHub Desktop.
Save danlamanna/de2f8a35f33d3a3d22b24196534f2af5 to your computer and use it in GitHub Desktop.
building caffe and packaging with fpm
FROM ubuntu:14.04
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev \
libhdf5-serial-dev protobuf-compiler libatlas-base-dev python-dev cmake git \
autotools-dev automake && apt-get install -y --no-install-recommends libboost-all-dev libboost-python1.55.0
RUN apt-get install -y python-pip
RUN pip install -U pip
RUN pip install numpy scikit-image protobuf
RUN apt-get install -y ruby ruby-dev gcc make
RUN gem install --no-ri --no-rdoc fpm
ENV CAFFE_URL="https://github.com/BVLC/caffe.git" \
CAFFE_VERSION=4ba654f5c8
RUN mkdir -p /caffe/source \
/caffe/build
RUN git clone https://github.com/BVLC/caffe.git /caffe/source \
&& cd /caffe/source \
&& git checkout ${CAFFE_VERSION}
# - Build, linking to deps
RUN cd /caffe/build \
&& cmake \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCPU_ONLY:BOOL=ON \
-DUSE_LEVELDB:BOOL=OFF \
-DUSE_LMDB:BOOL=OFF \
-DUSE_OPENCV:BOOL=OFF \
-DBUILD_PYTHON:BOOL=ON \
-DWITH_PYTHON_LAYER:BOOL=ON \
/caffe/source \
&& make -j$(nproc)
RUN mkdir /caffe/install
RUN cd /caffe/build && DESTDIR=/caffe/install make install
ENTRYPOINT ["fpm", "-s", "dir", "-t", "deb", \
"-n", "caffe-git", "-p", "/artifacts", \
"/caffe/install/caffe/build/install/=/usr/local"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment