All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.tika.parser.recognition.tf.InceptionVideoRestDockerfile Maven / Gradle / Ivy

There is a newer version: 3.0.0-BETA2
Show newest version
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

FROM ubuntu:16.04
MAINTAINER Thamme Gowda  and Kranthi Kiran GV  and \
           Madhav Sharan  and Chris Mattmann 

# 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 -j4
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/apache/tika/master/tika-parsers/src/main/resources/org/apache/tika/parser/recognition/tf/inceptionapi.py -O /usr/bin/inceptionapi.py && \
  wget https://raw.githubusercontent.com/apache/tika/master/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 OpenCV source 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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy