Skip to content

Instantly share code, notes, and snippets.

@shal
Created August 30, 2020 20:58
Show Gist options
  • Select an option

  • Save shal/336caed377e9ee4c9c7ac21d36bb638f to your computer and use it in GitHub Desktop.

Select an option

Save shal/336caed377e9ee4c9c7ac21d36bb638f to your computer and use it in GitHub Desktop.

Revisions

  1. shal created this gist Aug 30, 2020.
    42 changes: 42 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,42 @@
    FROM alpine:3.12

    ENV OPENCV_VERSION=4.4.0

    ARG LD_LIBRARY_PATH=/usr/local/lib
    ARG MAKEFLAGS="-j2"
    ARG PKG_CONFIG_PATH="/usr/local/share/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig"
    ARG PREFIX=/usr/local
    ARG LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64:/usr/lib64:/usr/lib:/lib64:/lib"


    RUN buildDeps="tiff zlib libpng libjpeg \
    tiff-dev zlib-dev libpng-dev jpeg-dev \
    autoconf \
    m4 \
    linux-headers \
    build-base \
    gcc \
    make \
    cmake \
    pkgconfig \
    automake \
    ca-certificates \
    g++ \
    curl \
    git \
    curl-dev \
    libtool" && \
    apk update && apk upgrade&& \
    apk add --no-cache ${buildDeps}

    RUN DIR=/tmp/opencv && \
    mkdir -p ${DIR} && \
    cd ${DIR} && \
    curl -sL https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz | \
    tar -zx --strip-components=1 && \
    mkdir -p ${DIR}/build && \
    cd ${DIR}/build && \
    cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=${PREFIX} .. && \
    make && \
    make install && \
    rm -rf ${DIR}