-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
75 lines (69 loc) · 3.85 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM python:3.6.3-stretch
ARG BAZEL_VERSION=0.5.4
RUN echo "deb http://ftp.uk.debian.org/debian experimental main" >> /etc/apt/sources.list \
&& curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | apt-key add - \
&& apt-get -y update \
&& apt-get -y install autoconf-archive automake g++ libtool pkg-config unzip build-essential cmake \
libatlas-base-dev gfortran libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev libjpeg-dev libpng-dev \
libtiff-dev libv4l-dev libleptonica-dev openjdk-8-jdk openjdk-8-jre-headless ca-certificates-java \
clang-format-3.8 libcurl4-openssl-dev libtool python-dev python-setuptools python-virtualenv \
python3-dev python3-setuptools zlib1g-dev bash-completion\
&& pip install numpy==1.13.3 wheel \
&& curl -LO "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel_${BAZEL_VERSION}-linux-x86_64.deb" \
&& dpkg -i bazel_*.deb \
&& update-ca-certificates -f
# install tensorflow from sources
RUN curl -sSL https://github.com/tensorflow/tensorflow/archive/v1.4.0.zip -o tensorflow.zip \
&& unzip -q tensorflow.zip && mv /tensorflow-1.4.0 /tensorflow && rm tensorflow.zip \
&& cd tensorflow \
&& tensorflow/tools/ci_build/builds/configured CPU \
&& touch WORKSPACE \
&& echo "startup --batch\nbuild --spawn_strategy=standalone --genrule_strategy=standalone" >>/etc/bazel.bazelrc \
&& bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.2 \
--output_filter='^//tensorflow' //tensorflow/tools/pip_package:build_pip_package \
&& bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg \
&& pip install --upgrade /tmp/tensorflow_pkg/tensorflow-*.whl \
&& cd / && rm -rf /root/.cache /tmp/tensorflow_pkg tensorflow
# install opencv3.3.0
RUN curl -sSL https://github.com/Itseez/opencv/archive/3.3.0.zip -o opencv3.zip \
&& unzip -q opencv3.zip && mv /opencv-3.3.0 /opencv && rm opencv3.zip \
&& curl -sSL https://github.com/Itseez/opencv_contrib/archive/3.3.0.zip -o opencv_contrib3.zip \
&& unzip -q opencv_contrib3.zip && mv /opencv_contrib-3.3.0 /opencv_contrib && rm opencv_contrib3.zip \
&& mkdir /opencv/build && cd /opencv/build \
&& cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_PYTHON_SUPPORT=ON \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules \
-D BUILD_EXAMPLES=OFF \
-D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python \
-D BUILD_opencv_python3=ON \
-D BUILD_opencv_python2=OFF \
-D WITH_IPP=OFF \
-D WITH_FFMPEG=ON \
-D WITH_V4L=ON .. \
&& cd /opencv/build && make -j$(nproc) && make install && ldconfig \
&& rm -rf /opencv /opencv_contrib
# install tesseract4
RUN cd / \
&& apt-get install -y -t experimental libtesseract-dev \
&& curl -sSL https://github.com/tesseract-ocr/tesseract/archive/ebbfc3ae8df85c351002000a76900e3086375e7b.zip -o tesseract-ocr.zip \
&& unzip tesseract-ocr.zip && rm tesseract-ocr.zip \
&& cd tesseract-*/ \
&& . ./autogen.sh \
&& ./configure \
&& make \
&& make install \
&& ldconfig \
&& cd .. \
&& rm -rf tesseract-*/ \
&& curl -sSL https://github.com/tesseract-ocr/tessdata_fast/archive/45ed289c6b40b7bed032da2c07adb7ea7e3f231e.zip \
-o /usr/local/share/tessdata_fast.zip \
&& unzip /usr/local/share/tessdata_fast.zip && rm /usr/local/share/tessdata_fast.zip \
&& mv tessdata_fast-45ed289c6b40b7bed032da2c07adb7ea7e3f231e tessdata_fast \
&& CPPFLAGS=-DUSE_STD_NAMESPACE pip install tesserocr==2.2.2
# clean up
RUN apt-get -y remove --purge autoconf-archive automake g++ libtool unzip build-essential cmake pkg-config \
libatlas-base-dev gfortran libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev \
libjpeg-dev libpng-dev libtiff-dev libv4l-dev libcurl4-openssl-dev libtool zlib1g-dev\
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*