-
Notifications
You must be signed in to change notification settings - Fork 161
/
Dockerfile
55 lines (51 loc) · 1.67 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
FROM python:3.9
LABEL mantainer="Josip Janzic <josip@jjanzic.com>"
WORKDIR /opt/build
ENV OPENCV_VERSION="4.5.1"
RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends \
build-essential \
cmake \
git \
wget \
unzip \
yasm \
pkg-config \
libswscale-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libopenjp2-7-dev \
libavformat-dev \
libpq-dev \
&& pip install numpy \
&& wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip -O opencv.zip \
&& unzip -qq opencv.zip -d /opt \
&& rm -rf opencv.zip \
&& cmake \
-D BUILD_TIFF=ON \
-D BUILD_opencv_java=OFF \
-D WITH_CUDA=OFF \
-D WITH_OPENGL=ON \
-D WITH_OPENCL=ON \
-D WITH_IPP=ON \
-D WITH_TBB=ON \
-D WITH_EIGEN=ON \
-D WITH_V4L=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=$(python3.9 -c "import sys; print(sys.prefix)") \
-D PYTHON_EXECUTABLE=$(which python3.9) \
-D PYTHON_INCLUDE_DIR=$(python3.9 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON_PACKAGES_PATH=$(python3.9 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
/opt/opencv-${OPENCV_VERSION} \
&& make -j$(nproc) \
&& make install \
&& rm -rf /opt/build/* \
&& rm -rf /opt/opencv-${OPENCV_VERSION} \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -qq autoremove \
&& apt-get -qq clean