-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
93 lines (78 loc) · 3.1 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Dockerfile with tensorflow cpu support on python3, opencv3.3
FROM tensorflow/tensorflow:1.4.0-py3
RUN apt-get update
ENV NUM_CORES 2
ENV PYTHONPATH "${PYTHONPATH}:/home/TF:/home/TF/slim"
RUN apt-get -y update -qq && \
apt-get -y install wget \
apt-utils \
unzip \
# Required
build-essential \
cmake \
git \
pkg-config \
libatlas-base-dev \
libgtk2.0-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
# Optional
libtbb2 libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libv4l-dev \
libdc1394-22-dev \
qt4-default \
# Missing libraries for GTK
libatk-adaptor \
libcanberra-gtk-module \
# Tools
imagemagick \
# For use matplotlib.pyplot in python
python3-tk
# Build and install OpenCV
WORKDIR /
RUN wget https://github.com/opencv/opencv/archive/3.3.0.zip \
&& unzip 3.3.0.zip \
&& mkdir /opencv-3.3.0/cmake_binary \
&& cd /opencv-3.3.0/cmake_binary \
&& cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D WITH_IPP=OFF \
-D WITH_TBB=ON \
-D ENABLE_AVX=ON \
-D WITH_CUDA=OFF \
-D PYTHON_EXECUTABLE=$(which python3) \
-D PYTHON_DEFAULT_EXECUTABLE=$(which python3) \
-D PYTHON_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON_LIBRARY=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR')+'/'+sysconfig.get_config_var('LDLIBRARY'))") \
-D PYTHON3_EXECUTABLE=$(which python3) \
-D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_INCLUDE_PATH=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_LIBRARIES=$(python3 -c "import sysconfig; print(sysconfig.get_config_var('LIBDIR')+'/'+sysconfig.get_config_var('LDLIBRARY'))") \
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-D BUILD_EXAMPLES=OFF .. \
&& make -j$NUM_CORES \
&& make install \
&& cd / \
&& rm /3.3.0.zip \
&& rm -r /opencv-3.3.0
RUN apt-get -y install libgtk-3-dev \
libboost-all-dev
RUN pip3 --no-cache-dir install \
h5py \
numpy \
hdf5storage \
scipy \
py3nvml \
scikit-image \
PyYAML \
pillow \
lxml \
matplotlib
WORKDIR "/home/TF"
CMD ["/bin/bash"]