From 6dbdf957e4d269210180085fdf816a1237a332af Mon Sep 17 00:00:00 2001 From: Olli-Pekka Heinisuo Date: Wed, 2 May 2018 23:04:50 +0300 Subject: [PATCH] add dockerfiles and readme --- docker/Dockerfile_i686 | 87 ++++++++++++++++++++++++++++++++++++++++ docker/Dockerfile_x86_64 | 87 ++++++++++++++++++++++++++++++++++++++++ docker/README.md | 15 +++++++ 3 files changed, 189 insertions(+) create mode 100644 docker/Dockerfile_i686 create mode 100644 docker/Dockerfile_x86_64 create mode 100644 docker/README.md diff --git a/docker/Dockerfile_i686 b/docker/Dockerfile_i686 new file mode 100644 index 0000000..b788b96 --- /dev/null +++ b/docker/Dockerfile_i686 @@ -0,0 +1,87 @@ +FROM quay.io/pypa/manylinux1_i686:latest + +RUN wget --no-check-certificate https://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz && \ + tar -xf qt-everywhere-opensource-src-4.8.7.tar.gz && \ + cd qt-everywhere* && \ + ./configure -prefix /opt/Qt4.8.7 -release -opensource -confirm-license && \ + gmake && \ + gmake install && \ + cd .. && \ + rm -rf qt-everywhere-opensource-src-4.8.7 && \ + rm qt-everywhere-opensource-src-4.8.7.tar.gz + +ENV QTDIR /opt/Qt4.8.7 +ENV PATH "$QTDIR/bin:$PATH" + +RUN wget --no-check-certificate https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz && \ + tar -zxf cmake-3.9.0.tar.gz && \ + cd cmake-3.9.0 && \ + yum -y install curl-devel zlib-devel && \ + ./configure --system-curl && \ + make && \ + make install && \ + cd .. && \ + rm -rf cmake-3.9.0* + +RUN yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ libtool make mercurial pkgconfig zlib-devel -y && \ + yum remove nasm -y && \ + mkdir ~/ffmpeg_sources && \ + cd ~/ffmpeg_sources && \ + curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 && \ + tar xjvf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \ + ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + make -j4 && \ + make install && \ + cd ~/ffmpeg_sources && \ + curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \ + tar xzvf yasm-1.3.0.tar.gz && \ + cd yasm-1.3.0 && \ + ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + make -j4 && \ + make install && \ + cd ~/ffmpeg_sources && \ + git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ + cd libvpx && \ + ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ + make -j4 && \ + make install && \ + cd ~/ffmpeg_sources && \ + curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \ + tar xjvf ffmpeg-snapshot.tar.bz2 && \ + cd ffmpeg && \ + PATH=~/bin:$PATH && \ + PKG_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-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ + make -j4 && \ + make install && \ + echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ + ldconfig && \ + rm -rf ~/ffmpeg_sources + +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig +ENV LDFLAGS -L/root/ffmpeg_build/lib + +RUN mkdir libjpeg-turbo && \ + cd libjpeg-turbo && \ + export PATH=~/bin:$PATH && \ + curl -L https://kent.dl.sourceforge.net/project/libjpeg-turbo/1.5.3/libjpeg-turbo-1.5.3.tar.gz > libjpeg-turbo-1.5.3.tar.gz && \ + tar xzvf libjpeg-turbo-1.5.3.tar.gz && \ + cd libjpeg-turbo-1.5.3 && \ + export CFLAGS="-fPIC" && \ + export CXXFLAGS="-fPIC" && \ + autoreconf -fiv && \ + ./configure --host=i686-pc-linux-gnu && \ + make && \ + make install && \ + cd ../../ && \ + rm -rf libjpeg-turbo + +ENV JPEG_LIBRARY /opt/libjpeg-turbo/lib32/libjpeg.a +ENV JPEG_INCLUDE_DIR /opt/libjpeg-turbo/include + +RUN curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/videodev2.h && \ + curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-common.h && \ + curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-controls.h && \ + curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/linux/compiler.h && \ + mv videodev2.h v4l2-common.h v4l2-controls.h compiler.h /usr/include/linux + +ENV PATH "$PATH=~/bin:$PATH" \ No newline at end of file diff --git a/docker/Dockerfile_x86_64 b/docker/Dockerfile_x86_64 new file mode 100644 index 0000000..4919f89 --- /dev/null +++ b/docker/Dockerfile_x86_64 @@ -0,0 +1,87 @@ +FROM quay.io/pypa/manylinux1_x86_64:latest + +RUN wget --no-check-certificate https://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz && \ + tar -xf qt-everywhere-opensource-src-4.8.7.tar.gz && \ + cd qt-everywhere* && \ + ./configure -prefix /opt/Qt4.8.7 -release -opensource -confirm-license && \ + gmake && \ + gmake install && \ + cd .. && \ + rm -rf qt-everywhere-opensource-src-4.8.7 && \ + rm qt-everywhere-opensource-src-4.8.7.tar.gz + +ENV QTDIR /opt/Qt4.8.7 +ENV PATH "$QTDIR/bin:$PATH" + +RUN wget --no-check-certificate https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz && \ + tar -zxf cmake-3.9.0.tar.gz && \ + cd cmake-3.9.0 && \ + yum -y install curl-devel zlib-devel && \ + ./configure --system-curl && \ + make && \ + make install && \ + cd .. && \ + rm -rf cmake-3.9.0* + +RUN yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ libtool make mercurial pkgconfig zlib-devel -y && \ + yum remove nasm -y && \ + mkdir ~/ffmpeg_sources && \ + cd ~/ffmpeg_sources && \ + curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 && \ + tar xjvf nasm-2.13.02.tar.bz2 && cd nasm-2.13.02 && ./autogen.sh && \ + ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + make -j4 && \ + make install && \ + cd ~/ffmpeg_sources && \ + curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \ + tar xzvf yasm-1.3.0.tar.gz && \ + cd yasm-1.3.0 && \ + ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + make -j4 && \ + make install && \ + cd ~/ffmpeg_sources && \ + git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ + cd libvpx && \ + ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ + make -j4 && \ + make install && \ + cd ~/ffmpeg_sources && \ + curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \ + tar xjvf ffmpeg-snapshot.tar.bz2 && \ + cd ffmpeg && \ + PATH=~/bin:$PATH && \ + PKG_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-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ + make -j4 && \ + make install && \ + echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ + ldconfig && \ + rm -rf ~/ffmpeg_sources + +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig +ENV LDFLAGS -L/root/ffmpeg_build/lib + +RUN mkdir libjpeg-turbo && \ + cd libjpeg-turbo && \ + export PATH=~/bin:$PATH && \ + curl -L https://kent.dl.sourceforge.net/project/libjpeg-turbo/1.5.3/libjpeg-turbo-1.5.3.tar.gz > libjpeg-turbo-1.5.3.tar.gz && \ + tar xzvf libjpeg-turbo-1.5.3.tar.gz && \ + cd libjpeg-turbo-1.5.3 && \ + export CFLAGS="-fPIC" && \ + export CXXFLAGS="-fPIC" && \ + autoreconf -fiv && \ + ./configure && \ + make && \ + make install && \ + cd ../../ && \ + rm -rf libjpeg-turbo + +ENV JPEG_LIBRARY /opt/libjpeg-turbo/lib64/libjpeg.a +ENV JPEG_INCLUDE_DIR /opt/libjpeg-turbo/include + +RUN curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/videodev2.h && \ + curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-common.h && \ + curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/uapi/linux/v4l2-controls.h && \ + curl -O https://raw.githubusercontent.com/torvalds/linux/v4.14/include/linux/compiler.h && \ + mv videodev2.h v4l2-common.h v4l2-controls.h compiler.h /usr/include/linux + +ENV PATH "$PATH=~/bin:$PATH" \ No newline at end of file diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..9e932c4 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,15 @@ +### Customized manylinux images for opencv-python + +This folder includes Dockerfiles for extending both ``i686`` and ``x86_64`` manylinux images. + +The extended images were created to be able to build OpenCV in reasonable time with Travis. + +These images have been built locally because the process takes over an hour with modern i7 processor. The images are hosted at https://quay.io/user/skvark. + +The images have following extra software installed: + +- Qt 4.8.7 +- Cmake 3.9.0 +- FFmpeg with libvpx +- libjpeg-turbo 1.5.3 +- Some missing headers included from more recent Linux to be able to enable V4L / V4L2 support in OpenCV \ No newline at end of file -- GitLab