-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile-alpine-text.template
105 lines (102 loc) · 2.88 KB
/
Dockerfile-alpine-text.template
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
# Image
FROM %%IMAGE%%
# Environment variables
ENV OPENCV_VERSION=%%OPENCVVERSION%%
# Install needed packages
RUN set -ex \
&& echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
&& echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk add --no-cache \
build-base cmake \
wget unzip \
hdf5 hdf5-dev \
protobuf protobuf-dev \
openblas openblas-dev@community \
libjpeg libjpeg-turbo-dev \
libpng libpng-dev \
tiff tiff-dev \
libwebp libwebp-dev \
openjpeg openjpeg-dev openjpeg-tools \
libtbb@community libtbb-dev@community \
eigen eigen-dev \
linux-headers \
\
# Download source files
&& mkdir -p /opt/build && cd /opt/build \
&& wget -q https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.zip -O opencv.zip \
&& unzip -qq opencv.zip -d /opt && rm -rf opencv.zip \
&& wget -q https://github.com/opencv/opencv_contrib/archive/${OPENCV_VERSION}.zip -O opencv_contrib.zip \
&& unzip -qq opencv_contrib.zip -d /opt && rm -rf opencv_contrib.zip \
\
# Prepare optimal build settings
&& NB_CORES=$(grep -c '^processor' /proc/cpuinfo) \
\
# Install opencv
&& cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \
-D OPENCV_ENABLE_NONFREE=OFF \
-D WITH_JPEG=ON \
-D WITH_PNG=ON \
-D WITH_TIFF=ON \
-D WITH_WEBP=ON \
-D WITH_JASPER=ON \
-D WITH_EIGEN=ON \
-D WITH_TBB=ON \
-D WITH_LAPACK=ON \
-D WITH_PROTOBUF=ON \
-D WITH_V4L=OFF \
-D WITH_GSTREAMER=OFF \
-D WITH_GTK=OFF \
-D WITH_QT=OFF \
-D WITH_CUDA=OFF \
-D WITH_VTK=OFF \
-D WITH_OPENEXR=OFF \
-D WITH_FFMPEG=OFF \
-D WITH_OPENCL=OFF \
-D WITH_OPENNI=OFF \
-D WITH_XINE=OFF \
-D WITH_GDAL=OFF \
-D WITH_IPP=OFF \
-D BUILD_OPENCV_PYTHON3=OFF \
-D BUILD_OPENCV_PYTHON2=OFF \
-D BUILD_OPENCV_JAVA=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_IPP_IW=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_EXAMPLES=OFF \
-D BUILD_ANDROID_EXAMPLES=OFF \
-D BUILD_DOCS=OFF \
-D BUILD_ITT=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_TESTS=OFF \
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib-${OPENCV_VERSION}/modules/text \
/opt/opencv-${OPENCV_VERSION} \
&& make --jobs $(($NB_CORES*2)) --silent \
&& make install \
\
# Clean up when done
&& rm -rf /opt/build/* \
&& rm -rf /opt/opencv-${OPENCV_VERSION} \
&& rm -rf /opt/opencv_contrib-${OPENCV_VERSION} \
&& apk del --no-cache \
build-base cmake \
wget unzip \
hdf5-dev \
protobuf-dev \
openblas-dev \
libjpeg-turbo-dev \
libpng-dev \
tiff-dev \
libwebp-dev \
openjpeg-dev openjpeg-tools \
libtbb-dev \
eigen-dev \
linux-headers
ENV OPENCV_LIB_DIR=/usr/local/lib
ENV OPENCV_INCLUDE_DIR=/usr/local/include/opencv4
ENV OPENCV_BIN_DIR=/usr/local/bin
%%END%%