diff --git a/Dockerfile b/Dockerfile old mode 100644 new mode 100755 index 9bdd46e..69ceee2 --- a/Dockerfile +++ b/Dockerfile @@ -1,31 +1,31 @@ -FROM bamos/ubuntu-opencv-dlib-torch:ubuntu_14.04-opencv_2.4.11-dlib_19.0-torch_2016.07.12 +# Note from Brandon on 2015-01-13: +# +# Always push this from an OSX Docker machine. +# +# If I build this on my Arch Linux desktop it works fine locally, +# but dlib gives an `Illegal Instruction (core dumped)` error in +# dlib.get_frontal_face_detector() when running on OSX in a Docker machine. +# Building in a Docker machine on OSX fixes this issue and the built +# container successfully deploys on my Arch Linux desktop. +# +# Building and pushing: +# docker build -f opencv-dlib-torch.Dockerfile -t opencv-dlib-torch . +# docker tag -f bamos/ubuntu-opencv-dlib-torch:ubuntu_latest-opencv_3.2.0-dlib_19.2-torch_2017.01.29 +# docker push bamos/ubuntu-opencv-dlib-torch:ubuntu_latest-opencv_3.2.0-dlib_19.2-torch_2017.01.29 + +FROM bamos/ubuntu-opencv-dlib-torch:ubuntu_latest-opencv_3.2.0-dlib_19.2-torch_2017.01.29 MAINTAINER Brandon Amos -# TODO: Should be added to opencv-dlib-torch image. -RUN ln -s /root/torch/install/bin/* /usr/local/bin - -RUN apt-get update && apt-get install -y \ - curl \ - git \ - graphicsmagick \ - python-dev \ - python-pip \ - python-numpy \ - python-nose \ - python-scipy \ - python-pandas \ - python-protobuf\ - wget \ - zip \ - && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -ADD . /root/openface -RUN cd ~/openface && \ +# OpenFace +############################################################################### +RUN cd ~ && \ + git clone https://github.com/qacollective/openface.git ~/openface --recursive && \ + cd ~/openface && \ ./models/get-models.sh && \ - pip2 install -r requirements.txt && \ - python2 setup.py install && \ - pip2 install -r demos/web/requirements.txt && \ - pip2 install -r training/requirements.txt + pip3 install -r requirements.txt && \ + python3.5 setup.py install && \ + pip3 install -r demos/web/requirements.txt && \ + pip3 install -r training/requirements.txt EXPOSE 8000 9000 CMD /bin/bash -l -c '/root/openface/demos/web/start-servers.sh' diff --git a/opencv-dlib-torch.Dockerfile b/opencv-dlib-torch.Dockerfile index 5c81d5e..91cb223 100644 --- a/opencv-dlib-torch.Dockerfile +++ b/opencv-dlib-torch.Dockerfile @@ -8,41 +8,31 @@ # Building in a Docker machine on OSX fixes this issue and the built # container successfully deploys on my Arch Linux desktop. # +# Building this Dockerfile results in the download of approximately 450 MB of data. +# # Building and pushing: # docker build -f opencv-dlib-torch.Dockerfile -t opencv-dlib-torch . -# docker tag -f bamos/ubuntu-opencv-dlib-torch:ubuntu_14.04-opencv_2.4.11-dlib_18.16-torch_2016.03.19 -# docker push bamos/ubuntu-opencv-dlib-torch:ubuntu_14.04-opencv_2.4.11-dlib_18.16-torch_2016.03.19 +# docker tag -f bamos/ubuntu-opencv-dlib-torch:ubuntu_latest-opencv_3.2.0-dlib_19.2-torch_2017.01.29 +# docker push bamos/ubuntu-opencv-dlib-torch:ubuntu_latest-opencv_3.2.0-dlib_19.2-torch_2017.01.29 -FROM ubuntu:14.04 +FROM ubuntu MAINTAINER Brandon Amos -RUN apt-get update && apt-get install -y \ - build-essential \ - cmake \ - curl \ - gfortran \ - git \ - graphicsmagick \ - libgraphicsmagick1-dev \ - libatlas-dev \ - libavcodec-dev \ - libavformat-dev \ - libboost-all-dev \ - libgtk2.0-dev \ - libjpeg-dev \ - liblapack-dev \ - libswscale-dev \ - pkg-config \ - python-dev \ - python-numpy \ - python-protobuf\ - software-properties-common \ - zip \ - && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN apt-get update && apt-get install -y apt-utils -RUN curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash -e +# Python 3.5 +############################################################################### +RUN apt-get install -y python3.5 python3-pip python3.5-dev python3.5-numpy +RUN pip3 install --upgrade pip + + +# Torch +############################################################################### +RUN apt-get install -y git sudo curl luarocks libqtgui4 libqtcore4 libreadline-dev graphicsmagick libgraphicsmagick1-dev RUN git clone https://github.com/torch/distro.git ~/torch --recursive -RUN cd ~/torch && ./install.sh && \ +RUN cd ~/torch && \ + bash install-deps && \ + ./install.sh && \ cd install/bin && \ ./luarocks install nn && \ ./luarocks install dpnn && \ @@ -50,14 +40,20 @@ RUN cd ~/torch && ./install.sh && \ ./luarocks install optim && \ ./luarocks install csvigo && \ ./luarocks install torchx && \ - ./luarocks install tds + ./luarocks install tds && \ + ./luarocks install graphicsmagick && \ + ln -s /root/torch/install/bin/* /usr/local/bin + +# OpenCV 3.2 +############################################################################### +RUN apt-get install -y zip cmake pkg-config RUN cd ~ && \ mkdir -p ocv-tmp && \ cd ocv-tmp && \ - curl -L https://github.com/Itseez/opencv/archive/2.4.11.zip -o ocv.zip && \ + curl -L https://github.com/Itseez/opencv/archive/3.2.0.zip -o ocv.zip && \ unzip ocv.zip && \ - cd opencv-2.4.11 && \ + cd opencv-3.2.0 && \ mkdir release && \ cd release && \ cmake -D CMAKE_BUILD_TYPE=RELEASE \ @@ -68,17 +64,22 @@ RUN cd ~ && \ make install && \ rm -rf ~/ocv-tmp + +# Dlib 19.2 +############################################################################### +# Note: Python 2.7 is still installed due to libboost-all-dev +RUN apt-get install -y libx11-dev libboost-all-dev RUN cd ~ && \ mkdir -p dlib-tmp && \ cd dlib-tmp && \ curl -L \ - https://github.com/davisking/dlib/archive/v19.0.tar.gz \ - -o dlib.tar.bz2 && \ - tar xf dlib.tar.bz2 && \ - cd dlib-19.0/python_examples && \ + http://dlib.net/files/dlib-19.2.zip \ + -o dlib.zip && \ + unzip dlib.zip && \ + cd dlib-19.2/examples && \ mkdir build && \ cd build && \ - cmake ../../tools/python && \ + cmake .. -DUSE_SSE4_INSTRUCTIONS=ON && \ cmake --build . --config Release && \ - cp dlib.so /usr/local/lib/python2.7/dist-packages && \ - rm -rf ~/dlib-tmp \ No newline at end of file + python3.5 ../../setup.py install --yes USE_AVX_INSTRUCTIONS && \ + rm -rf ~/dlib-tmp