Skip to content

Commit

Permalink
Merge pull request peterbraden#306 from borromeotlhs/opencv3
Browse files Browse the repository at this point in the history
opencv3 Dockerfile
  • Loading branch information
peterbraden authored Sep 23, 2016
2 parents 6273a98 + 77e7227 commit 25387ea
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ charset = utf-8

# Tab indentation (no size specified)
[Makefile]
indent_style = space
indent_style = tab
indent_size = 2

# Indentation override for all JS under lib directory
Expand Down
16 changes: 15 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
language: node_js

os:
- linux
# - osx

matrix:
allow_failures:
- os: osx

node_js:
- '0.12'
- "iojs-v1.0.4"
# - "iojs-v1.0.4"

sudo: required
services:
- docker

compiler: clang

Expand Down Expand Up @@ -42,6 +54,8 @@ install:
# test our module
- npm test
- node lib/opencv.js
- docker build -t peterbraden/node-opencv-ubuntu-12-04 -f test/Dockerfile-ubuntu-12-04 .
- docker build -t peterbraden/node-opencv-ubuntu-14-04 -f test/Dockerfile-ubuntu-14-04 .

before_script:
- echo "Publishing native platform Binary Package? ->" $PUBLISH_BINARY
Expand Down
89 changes: 77 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,80 @@
# 2) Build: wget https://raw.github.com/dotcloud/docker/v0.1.6/contrib/docker-build/docker-build && python docker-build $USER/node-opencv < Dockerfile
# 3) Test: docker run $USER/node-opencv node -e "console.log(require('opencv').version)"
#
# VERSION 0.1
# DOCKER-VERSION 0.1.6

from ubuntu:12.04
run apt-get update -qq
run apt-get install -y software-properties-common python-software-properties
run add-apt-repository -y ppa:kubuntu-ppa/backports
run apt-get update
run apt-get install -y libcv-dev libcvaux-dev libhighgui-dev libopencv-dev
run curl -sL https://deb.nodesource.com/setup | bash -
run apt-get install -y nodejs
run npm install opencv || cat npm-debug.log
# VERSION 0.3
# DOCKER-VERSION 8.1.2


# update to 14.04
FROM ubuntu:14.04

# listing myself as maintainer of _this_ Dockerfile, though I am not the author of the install script (credit to http://rodrigoberriel.com/)
MAINTAINER [email protected]

# run Rodrigo Berriel’s script for installing opencv3 on Ubuntu 14.04
# I’ll convert this into a full Dockerfile later, once I see if it works
#COPY ./install-opencv3.sh /tmp/

# this is needed as libfaac-dev comes from multiverse, according to:
# http://superuser.com/questions/467774/how-to-install-libfaac-dev
RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse\n\
deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse\n\
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse\n\
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse\n"\
>> /etc/apt/sources.list


RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
software-properties-common
RUN add-apt-repository ppa:george-edison55/cmake-3.x
RUN apt-get update -qq
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl \
cmake \
wget \
unzip \
libopencv-dev \
build-essential \
git \
libgtk2.0-dev \
pkg-config \
python-dev \
python-numpy \
libdc1394-22 \
libdc1394-22-dev \
libjpeg-dev \
libpng12-dev \
libtiff4-dev \
libjasper-dev \
libavcodec-dev \
libavformat-dev \
libswscale-dev \
libxine-dev \
libgstreamer0.10-dev \
libgstreamer-plugins-base0.10-dev \
libv4l-dev \
libtbb-dev \
libqt4-dev \
libfaac-dev \
libmp3lame-dev \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
libtheora-dev \
libvorbis-dev \
libxvidcore-dev \
x264 \
v4l-utils

RUN mkdir opencv
WORKDIR opencv

RUN wget https://github.com/Itseez/opencv/archive/3.0.0.zip -O opencv-3.0.0.zip
RUN unzip opencv-3.0.0.zip
RUN mkdir opencv-3.0.0/build
WORKDIR opencv-3.0.0/build

RUN cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_OPENGL=ON ..

RUN make -j $(nproc) && make install
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf
RUN ldconfig
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ release:
@echo "Publishing to NPM"
@npm publish
.PHONY: release


travis-build:
docker build -t peterbraden/node-opencv-ubuntu-12-04 -f test/Dockerfile-ubuntu-12-04 .
docker build -t peterbraden/node-opencv-ubuntu-14-04 -f test/Dockerfile-ubuntu-14-04 .
.PHONY: travis-build
2 changes: 2 additions & 0 deletions examples/salt.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
var cv = require('../lib/opencv');
cv.readImage("./files/mona.png", function(err, im) {
Expand All @@ -18,3 +19,4 @@ function salt(img, n) {
img.set(y, x, 255);
}
}
*/
13 changes: 13 additions & 0 deletions test/Dockerfile-ubuntu-12-04
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This is a dockerfile to test the build on ubuntu 12.04
from ubuntu:12.04
run apt-get update -qq
run apt-get install -y software-properties-common python-software-properties
run add-apt-repository -y ppa:kubuntu-ppa/backports
run apt-get update
run apt-get install -y libcv-dev libcvaux-dev libhighgui-dev libopencv-dev
run curl -sL https://deb.nodesource.com/setup | bash -
run apt-get install -y nodejs
WORKDIR /root/node-opencv
add . /root/node-opencv
run npm install --unsafe-perm --build-from-source || cat npm-debug.log
run make test
13 changes: 13 additions & 0 deletions test/Dockerfile-ubuntu-14-04
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This is a dockerfile to test the build on ubuntu 14.04
from ubuntu:14.04
run apt-get update -qq
run apt-get install -y software-properties-common python-software-properties
run add-apt-repository -y ppa:kubuntu-ppa/backports
run apt-get update
run apt-get install -y libcv-dev libcvaux-dev libhighgui-dev libopencv-dev
run curl -sL https://deb.nodesource.com/setup | bash -
run apt-get install -y nodejs
WORKDIR /root/node-opencv
add . /root/node-opencv
run npm install --unsafe-perm --build-from-source || cat npm-debug.log
run make test

0 comments on commit 25387ea

Please sign in to comment.