Skip to content

Instantly share code, notes, and snippets.

@joost
Created June 28, 2016 18:37
Show Gist options
  • Save joost/52d59321abe31884ab818b806c69426b to your computer and use it in GitHub Desktop.
Save joost/52d59321abe31884ab818b806c69426b to your computer and use it in GitHub Desktop.
Dockerfile for OpenCV 3.1.0 with Tesseract on Ubuntu 14.04
FROM phusion/passenger-full
# Set correct environment variables.
ENV HOME /root
ENV RUBY_VERSION 2.2.1
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
# ===================
# Install OpenCV
# Also see: https://gist.github.com/Asymptote/6d95396a1a45b55e3b63c3ee4d2b7c24
# ===================
RUN apt-get update
RUN apt-get install -y build-essential cmake git pkg-config
RUN apt-get install -y libjpeg8-dev libtiff4-dev libjasper-dev libpng12-dev
RUN apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
RUN apt-get install -y libgtk2.0-dev
RUN apt-get install -y libatlas-base-dev gfortran
# Tesseract
RUN apt-get install -y tesseract-ocr libtesseract-dev libleptonica-dev
# Install pip
RUN curl -O https://bootstrap.pypa.io/get-pip.py
RUN python3 get-pip.py
RUN apt-get install -y python3.4-dev
RUN pip install numpy
RUN cd ~;git clone https://github.com/Itseez/opencv.git;cd opencv;git checkout 3.1.0
RUN cd ~;git clone https://github.com/Itseez/opencv_contrib.git;cd opencv_contrib;git checkout 3.1.0
RUN cd ~/opencv;mkdir build;cd build;cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D BUILD_opencv_python3=ON \
-D BUILD_EXAMPLES=ON ..;make -j4;make install;ldconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment