-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDockerfile
110 lines (97 loc) · 3.22 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# MIT License
# Copyright (c) 2017 Juliano Petronetto
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE
FROM alpine:3.5
MAINTAINER Juliano Petronetto <[email protected]>
ENV LANG=C.UTF-8
# Add Edge repos
RUN echo -e "\n\
@edgemain http://nl.alpinelinux.org/alpine/edge/main\n\
@edgecomm http://nl.alpinelinux.org/alpine/edge/community\n\
@edgetest http://nl.alpinelinux.org/alpine/edge/testing"\
>> /etc/apk/repositories
# Install required packages
RUN apk update && apk upgrade && apk --no-cache add \
bash \
build-base \
ca-certificates \
clang-dev \
clang \
cmake \
coreutils \
curl \
freetype-dev \
ffmpeg-dev \
ffmpeg-libs \
gcc \
g++ \
git \
gettext \
lcms2-dev \
libavc1394-dev \
libc-dev \
libffi-dev \
libjpeg-turbo-dev \
libpng-dev \
libressl-dev \
libtbb@edgetest \
libtbb-dev@edgetest \
libwebp-dev \
linux-headers \
make \
musl \
openblas@edgecomm \
openblas-dev@edgecomm \
openjpeg-dev \
openssl \
python3 \
python3-dev \
tiff-dev \
unzip \
zlib-dev
# Python 3 as default
RUN ln -s /usr/bin/python3 /usr/local/bin/python && \
ln -s /usr/bin/pip3 /usr/local/bin/pip && \
pip install --upgrade pip
# Install NumPy
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h && \
pip install numpy
# Install OpenCV
RUN mkdir /opt && cd /opt && \
wget https://github.com/opencv/opencv/archive/3.2.0.zip && \
unzip 3.2.0.zip && rm 3.2.0.zip && \
wget https://github.com/opencv/opencv_contrib/archive/3.2.0.zip && \
unzip 3.2.0.zip && rm 3.2.0.zip \
&& \
cd /opt/opencv-3.2.0 && mkdir build && cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_C_COMPILER=/usr/bin/clang \
-D CMAKE_CXX_COMPILER=/usr/bin/clang++ \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D WITH_FFMPEG=ON \
-D WITH_TBB=ON \
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib-3.2.0/modules \
-D PYTHON_EXECUTABLE=/usr/local/bin/python \
.. \
&& \
make -j$(nproc) && make install && cd .. && rm -rf build \
&& \
cp -p $(find /usr/local/lib/python3.5/site-packages -name cv2.*.so) \
/usr/lib/python3.5/site-packages/cv2.so && \
python -c 'import cv2; print("Python: import cv2 - SUCCESS")'