Last active
December 22, 2018 14:15
-
-
Save ThejanW/bffe660f5a7718b8672ee49f855c6a6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Take base as Ubuntu: 16.04, then you can simply apt-get install ffmpeg | |
FROM ubuntu:16.04 | |
# Install missing part of ubuntu core + python + building dependencies | |
RUN apt-get update && \ | |
apt-get install -y wget git unzip curl \ | |
libtcmalloc-minimal4 software-properties-common apt-utils \ | |
build-essential cmake pkg-config \ | |
libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev \ | |
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ | |
libxvidcore-dev libx264-dev \ | |
libgtk2.0-dev \ | |
libatlas-base-dev gfortran \ | |
python2.7-dev \ | |
python-pip | |
# Install ffmpeg | |
RUN apt-get install -y ffmpeg | |
RUN \ | |
pip install --upgrade pip && \ | |
pip install numpy | |
# Download OpenCV + OpenCV_Contrib | |
WORKDIR /usr/local/src | |
RUN \ | |
wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.2.0.zip && \ | |
unzip opencv.zip && \ | |
wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.2.0.zip && \ | |
unzip opencv_contrib.zip | |
# Build + Install OpenCV | |
RUN mkdir -p opencv-3.2.0/build | |
WORKDIR /usr/local/src/opencv-3.2.0/build | |
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D INSTALL_PYTHON_EXAMPLES=ON \ | |
-D INSTALL_C_EXAMPLES=OFF \ | |
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.2.0/modules \ | |
-D BUILD_EXAMPLES=ON .. | |
RUN make -j8 | |
RUN make install | |
WORKDIR / | |
# Install tensorflow and other dependencies | |
RUN \ | |
pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.0.1-cp27-none-linux_x86_64.whl --ignore-installed && \ | |
pip install flask requests | |
# Get the TF-slim dependencies | |
# Downloading from a specific commit for future compatibility | |
RUN wget https://github.com/tensorflow/models/archive/c15fada28113eca32dc98d6e3bec4755d0d5b4c2.zip | |
RUN unzip c15fada28113eca32dc98d6e3bec4755d0d5b4c2.zip | |
RUN \ | |
wget https://raw.githubusercontent.com/smadha/tika/TIKA-2322/tika-parsers/src/main/resources/org/apache/tika/parser/recognition/tf/inceptionapi.py -O /usr/bin/inceptionapi.py && \ | |
wget https://raw.githubusercontent.com/smadha/tika/TIKA-2322/tika-parsers/src/main/resources/org/apache/tika/parser/recognition/tf/video_util.py -O /usr/bin/video_util.py && \ | |
chmod +x /usr/bin/inceptionapi.py && \ | |
chmod +x /usr/bin/video_util.py | |
# clean up cache + delete src files, so we can publish smaller image to hub | |
RUN apt-get clean | |
RUN rm -rf /usr/local/src | |
ENV PYTHONPATH="$PYTHONPATH:/models-c15fada28113eca32dc98d6e3bec4755d0d5b4c2/slim" | |
ENV LD_PRELOAD="/usr/lib/libtcmalloc_minimal.so.4" | |
# expose API port, this is the default port | |
EXPOSE 8764 | |
CMD inceptionapi.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment