-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
78 lines (67 loc) · 2.12 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
FROM python:3.7-alpine
ENV PYTHONUNBUFFERED=1
RUN echo -e '@edgunity http://nl.alpinelinux.org/alpine/edge/community\n\
@edge http://nl.alpinelinux.org/alpine/edge/main\n\
@testing http://nl.alpinelinux.org/alpine/edge/testing\n\
@community http://dl-cdn.alpinelinux.org/alpine/edge/community'\
>> /etc/apk/repositories
RUN apk add --update --no-cache --virtual=build-dependencies \
build-base \
openblas-dev \
unzip \
wget \
cmake \
libtbb \
libtbb-dev \
libjpeg \
libjpeg-turbo-dev \
libpng-dev \
tiff-dev \
libwebp-dev \
clang-dev \
linux-headers \
&& pip install -U --no-cache-dir numpy
ENV CC /usr/bin/clang
ENV CXX /usr/bin/clang++
ENV OPENCV_VERSION=4.6.0
RUN mkdir -p /opt && cd /opt && \
wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip && \
unzip ${OPENCV_VERSION}.zip && \
rm -rf ${OPENCV_VERSION}.zip
RUN mkdir -p /opt/opencv-${OPENCV_VERSION}/build && \
cd /opt/opencv-${OPENCV_VERSION}/build && \
cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_FFMPEG=NO \
-D WITH_IPP=NO \
-D WITH_OPENEXR=NO \
-D WITH_TBB=YES \
-D BUILD_EXAMPLES=NO \
-D BUILD_ANDROID_EXAMPLES=NO \
-D INSTALL_PYTHON_EXAMPLES=NO \
-D BUILD_DOCS=NO \
-D BUILD_TESTS=NO \
-D BUILD_PERF_TESTS=NO \
-D BUILD_JAVA=NO \
-D BUILD_opencv_python2=NO \
-D BUILD_opencv_python3=ON \
-D PYTHON3_EXECUTABLE=/usr/local/bin/python \
-D PYTHON3_INCLUDE_DIR=/usr/local/include/python3.7m/ \
-D PYTHON3_LIBRARY=/usr/local/lib/libpython3.so \
-D PYTHON_LIBRARY=/usr/local/lib/libpython3.so \
-D PYTHON3_PACKAGES_PATH=/usr/local/lib/python3.7/site-packages/ \
-D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.7/site-packages/numpy/core/include/ \
.. && \
make && \
make install && \
rm -rf /opt/opencv-${OPENCV_VERSION} && \
apk del build-dependencies && \
rm -rf /var/cache/apk/*
# runtime dependencies
RUN apk add --update --no-cache openblas libstdc++ libtbb libjpeg libwebp libpng libtiffxx
RUN mkdir /app
WORKDIR /app
COPY . .
ENV PATH="/py/bin:$PATH"
CMD ["python3" , "main.py"]