Public Repository

Last pushed: a year ago
Short Description
GoLang with OpenCV preinstalled
Full Description

Wanted to make a base image for a Go application that happened to use OpenCV.

Installing OpenCV from source is a hefty commitment (est. 30m, depending on your internet connection), so here's the attempt to make that process a bit more palatable.

Usage

When using this image you will want to add the following lines to your Dockerfile do add your source code, download dependencies, and install your app as an executable. This is taken directly from the official dockerhub golang onbuild repo, however there may be a need to install system dependencies before installing your go app, like mysql-client for example.

FROM psycodrumfreak/golang-opencv

# Install more system dependencies here

RUN mkdir -p /go/src/app
WORKDIR /go/src/app

COPY . /go/src/app
RUN go-wrapper download
RUN go-wrapper install

Source Dockerfile

FROM golang:1.7.1

RUN apt-get update && \
    # Compiler Installation
    DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes build-essential && \
    # OpenCV Required Dependencies
    DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes \
        cmake \
        git \
        libgtk2.0-dev \
        pkg-config \
        libavcodec-dev \
        libavformat-dev \
        libswscale-dev && \
    # OpenCV Optional Dependencies
    DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes \
        python-dev \
        python-numpy \
        libtbb2 \
        libtbb-dev \
        libjpeg-dev \
        libpng-dev \
        libtiff-dev \
        libjasper-dev \
        libdc1394-22-dev && \
    # Cleanup apt-get artifacts to keep image slim
    apt-get autoremove -y && \
    apt-get clean && \
    apt-get autoclean && \
    rm -rf /var/lib/apt/lists/* && \
    # Download, Compile, and install OpenCV
    git clone --branch 3.1.0 https://github.com/opencv/opencv.git /tmp/opencv && \
    cd /tmp/opencv && \
    cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local . && \
    make && \
    make install ** && \
    cd ../ && \
    rm -rf opencv
Docker Pull Command
Owner
psycodrumfreak

Comments (0)