opencv-python
111 строк · 4.8 Кб
1FROM quay.io/pypa/manylinux1_i686:latest
2
3RUN curl -O -L https://download.qt.io/archive/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz && \
4tar -xf qt-everywhere-opensource-src-4.8.7.tar.gz && \
5cd qt-everywhere* && \
6#configure does a bootstrap make under the hood
7#manylinux1 is too old to have `nproc`
8export MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) && \
9#OpenCV only links against QtCore, QtGui, QtTest
10./configure -prefix /opt/Qt4.8.7 -release -opensource -confirm-license -make && \
11make && \
12make install && \
13cd .. && \
14rm -rf qt-everywhere-opensource-src-4.8.7 && \
15rm qt-everywhere-opensource-src-4.8.7.tar.gz
16
17ENV QTDIR /opt/Qt4.8.7
18ENV PATH "$QTDIR/bin:$PATH"
19
20RUN curl -O -L https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz && \
21tar -xf cmake-3.9.0.tar.gz && \
22cd cmake-3.9.0 && \
23#manylinux1 provides curl-devel equivalent and libcurl statically linked
24# against the same newer OpenSSL as other source-built tools
25# (1.0.2s as of this writing)
26yum -y install zlib-devel && \
27#configure does a bootstrap make under the hood
28export MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) && \
29./configure --system-curl && \
30make && \
31make install && \
32cd .. && \
33rm -rf cmake-3.9.0*
34
35# https://trac.ffmpeg.org/wiki/CompilationGuide/Centos#GettheDependencies
36# manylinux provides the toolchain and git; we provide cmake
37RUN yum install freetype-devel bzip2-devel zlib-devel -y && \
38mkdir ~/ffmpeg_sources
39
40# Newer openssl configure requires newer perl
41RUN curl -O -L https://www.cpan.org/src/5.0/perl-5.20.1.tar.gz && \
42tar -xf perl-5.20.1.tar.gz && \
43cd perl-5.20.1 && \
44./Configure -des -Dprefix="$HOME/openssl_build" && \
45#perl build scripts do much redundant work
46# if running "make install" separately
47make install -j$(getconf _NPROCESSORS_ONLN) && \
48cd .. && \
49rm -rf perl-5.20.1*
50
51RUN cd ~/ffmpeg_sources && \
52curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1c.tar.gz && \
53tar -xf OpenSSL_1_1_1c.tar.gz && \
54cd openssl-OpenSSL_1_1_1c && \
55#in i686, ./config detects x64 in i686 container without linux32
56# when run from "docker build"
57PERL="$HOME/openssl_build/bin/perl" linux32 ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" shared zlib && \
58make -j$(getconf _NPROCESSORS_ONLN) && \
59#skip installing documentation
60make install_sw && \
61rm -rf ~/openssl_build
62
63RUN cd ~/ffmpeg_sources && \
64curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.14.01/nasm-2.14.01.tar.bz2 && \
65tar -xf nasm-2.14.01.tar.bz2 && cd nasm-2.14.01 && ./autogen.sh && \
66./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
67make -j$(getconf _NPROCESSORS_ONLN) && \
68make install
69
70RUN cd ~/ffmpeg_sources && \
71curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \
72tar -xf yasm-1.3.0.tar.gz && \
73cd yasm-1.3.0 && \
74./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
75make -j$(getconf _NPROCESSORS_ONLN) && \
76make install
77
78RUN cd ~/ffmpeg_sources && \
79git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
80cd libvpx && \
81./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
82make -j$(getconf _NPROCESSORS_ONLN) && \
83make install
84
85RUN cd ~/ffmpeg_sources && \
86curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
87tar -xf ffmpeg-snapshot.tar.bz2 && \
88cd ffmpeg && \
89PATH=~/bin:$PATH && \
90PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
91make -j$(getconf _NPROCESSORS_ONLN) && \
92make install && \
93echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
94ldconfig && \
95rm -rf ~/ffmpeg_sources
96
97ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig
98ENV LDFLAGS -L/root/ffmpeg_build/lib
99
100RUN curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/videodev2.h && \
101curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-common.h && \
102curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-controls.h && \
103curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/linux/compiler.h && \
104mv videodev2.h v4l2-common.h v4l2-controls.h compiler.h /usr/include/linux
105
106#in i686, yum metadata ends up with slightly wrong timestamps
107#which inhibits its update
108#https://github.com/skvark/opencv-python/issues/148
109RUN yum clean all
110
111ENV PATH "$HOME/bin:$PATH"
112