forked from ampervue/docker-python27-opencv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
220 lines (192 loc) · 5.58 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
FROM ubuntu:trusty
# https://github.com/ampervue/docker-python27-opencv
MAINTAINER David Karchmer <[email protected]>
########################################
#
# Image based on Ubuntu:trusty
#
# with Python 2.7
# and OpenCV 3 (built)
# plus a bunch of build essencials
#######################################
# Set Locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
#RUN apt-get -qq remove ffmpeg
RUN echo deb http://archive.ubuntu.com/ubuntu precise universe multiverse >> /etc/apt/sources.list; \
apt-get update -qq && apt-get install -y --force-yes \
curl \
git \
g++ \
autoconf \
automake \
mercurial \
libopencv-dev \
build-essential \
checkinstall \
cmake \
pkg-config \
yasm \
libtiff4-dev \
libpng-dev \
libjpeg-dev \
libjasper-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libdc1394-22-dev \
libxine-dev \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libv4l-dev \
libtbb-dev \
libgtk2.0-dev \
libfaac-dev \
libmp3lame-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
libtheora-dev \
libvorbis-dev \
libxvidcore-dev \
libtool \
v4l-utils \
python2.7 \
python2.7-dev \
python-numpy \
default-jdk \
ant \
wget \
unzip; \
apt-get clean
ENV YASM_VERSION 1.3.0
ENV OPENCV_VERSION 2.4.10
WORKDIR /usr/local/src
RUN git clone --depth 1 https://github.com/l-smash/l-smash
RUN git clone --depth 1 git://git.videolan.org/x264.git
RUN hg clone https://bitbucket.org/multicoreware/x265
#RUN git clone --depth 1 git://source.ffmpeg.org/ffmpeg
RUN git clone https://github.com/Itseez/opencv.git
RUN git clone https://github.com/Itseez/opencv_contrib.git
RUN git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
RUN git clone --depth 1 https://chromium.googlesource.com/webm/libvpx
RUN git clone --depth 1 git://git.opus-codec.org/opus.git
RUN git clone --depth 1 https://github.com/mulx/aacgain.git
RUN curl -Os http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz
RUN tar xzvf yasm-${YASM_VERSION}.tar.gz
# Build YASM
# =================================
WORKDIR /usr/local/src/yasm-${YASM_VERSION}
RUN ./configure --enable-static
RUN make -j 4
RUN make install
# =================================
# Build L-SMASH
# =================================
WORKDIR /usr/local/src/l-smash
RUN ./configure
RUN make -j 4
RUN make install
# =================================
# Build libx264
# =================================
WORKDIR /usr/local/src/x264
RUN ./configure --enable-static
RUN make -j 4
RUN make install
# =================================
# Build libx265
# =================================
WORKDIR /usr/local/src/x265/build/linux
RUN cmake -D CMAKE_INSTALL_PREFIX:PATH=/usr \
-D BUILD_SHARED_LIBS=OFF \
../../source
RUN make -j 4
RUN make install
# =================================
# Build libfdk-aac
# =================================
WORKDIR /usr/local/src/fdk-aac
RUN autoreconf -fiv
RUN ./configure --disable-shared --enable-static
RUN make -j 4
RUN make install
# =================================
# Build libvpx
# =================================
WORKDIR /usr/local/src/libvpx
RUN ./configure --disable-examples --enable-static
RUN make -j 4
RUN make install
# =================================
# Build libopus
# =================================
WORKDIR /usr/local/src/opus
RUN ./autogen.sh
RUN ./configure --disable-shared --enable-static
RUN make -j 4
RUN make install
# =================================
# Build OpenCV 3.x
# =================================
RUN apt-get update -qq && apt-get install -y --force-yes libopencv-dev
WORKDIR /usr/local/src
RUN mkdir -p opencv/release
WORKDIR /usr/local/src/opencv/release
RUN cmake -D OPENCV_EXTRA_MODULES_PATH=/usr/local/src/opencv_contrib/modules \
-D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_SHARED_LIBS=OFF \
-D WITH_FFMPEG=OFF \
-D BUILD_PNG=ON \
-D BUILD_JPEG=ON \
-D BUILD_ZLIB=ON \
-D WITH_GTK=OFF \
-D WITH_GTK_2_X=OFF \
-D WITH_1394=OFF \
-D WITH_V4L=OFF \
-D WITH_LIBV4L=OFF \
-D WITH_TBB=OFF \
-D BUILD_PYTHON_SUPPORT=OFF \
-D BUILD_DOCS=OFF \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D CMAKE_INSTALL_PREFIX=/usr/local \
..
RUN make -j4
RUN make install
RUN sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
RUN ldconfig
# =================================
# Build ffmpeg.
# =================================
#RUN apt-get update -qq && apt-get install -y --force-yes \
# libass-dev
#WORKDIR /usr/local/src/ffmpeg
#RUN ./configure --pkg-config-flags="--static" \
# --extra-libs="-ldl" \
# --enable-gpl \
# --enable-libass \
# --enable-libfdk-aac \
# --enable-libfontconfig \
# --enable-libfreetype \
# --enable-libfribidi \
# --enable-libmp3lame \
# --enable-libopus \
# --enable-libtheora \
# --enable-libvorbis \
# --enable-libvpx \
# --enable-libx264 \
# --enable-libx265 \
# --enable-nonfree
#RUN make -j 4
#RUN make install
# =================================
# Remove all tmpfile
# =================================
WORKDIR /usr/local/
RUN rm -rf /usr/local/src
# =================================
# Install pip
# =================================
#RUN curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | python