Skip to content

Commit 25387ea

Browse files
authored
Merge pull request #306 from borromeotlhs/opencv3
opencv3 Dockerfile
2 parents 6273a98 + 77e7227 commit 25387ea

File tree

7 files changed

+127
-14
lines changed

7 files changed

+127
-14
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ charset = utf-8
1212

1313
# Tab indentation (no size specified)
1414
[Makefile]
15-
indent_style = space
15+
indent_style = tab
1616
indent_size = 2
1717

1818
# Indentation override for all JS under lib directory

.travis.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
language: node_js
22

3+
os:
4+
- linux
5+
# - osx
6+
7+
matrix:
8+
allow_failures:
9+
- os: osx
10+
311
node_js:
412
- '0.12'
5-
- "iojs-v1.0.4"
13+
# - "iojs-v1.0.4"
14+
15+
sudo: required
16+
services:
17+
- docker
618

719
compiler: clang
820

@@ -42,6 +54,8 @@ install:
4254
# test our module
4355
- npm test
4456
- node lib/opencv.js
57+
- docker build -t peterbraden/node-opencv-ubuntu-12-04 -f test/Dockerfile-ubuntu-12-04 .
58+
- docker build -t peterbraden/node-opencv-ubuntu-14-04 -f test/Dockerfile-ubuntu-14-04 .
4559

4660
before_script:
4761
- echo "Publishing native platform Binary Package? ->" $PUBLISH_BINARY

Dockerfile

Lines changed: 77 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,80 @@
44
# 2) Build: wget https://raw.github.com/dotcloud/docker/v0.1.6/contrib/docker-build/docker-build && python docker-build $USER/node-opencv < Dockerfile
55
# 3) Test: docker run $USER/node-opencv node -e "console.log(require('opencv').version)"
66
#
7-
# VERSION 0.1
8-
# DOCKER-VERSION 0.1.6
9-
10-
from ubuntu:12.04
11-
run apt-get update -qq
12-
run apt-get install -y software-properties-common python-software-properties
13-
run add-apt-repository -y ppa:kubuntu-ppa/backports
14-
run apt-get update
15-
run apt-get install -y libcv-dev libcvaux-dev libhighgui-dev libopencv-dev
16-
run curl -sL https://deb.nodesource.com/setup | bash -
17-
run apt-get install -y nodejs
18-
run npm install opencv || cat npm-debug.log
7+
# VERSION 0.3
8+
# DOCKER-VERSION 8.1.2
9+
10+
11+
# update to 14.04
12+
FROM ubuntu:14.04
13+
14+
# listing myself as maintainer of _this_ Dockerfile, though I am not the author of the install script (credit to http://rodrigoberriel.com/)
15+
MAINTAINER borromeotlhs@gmail.com
16+
17+
# run Rodrigo Berriel’s script for installing opencv3 on Ubuntu 14.04
18+
# I’ll convert this into a full Dockerfile later, once I see if it works
19+
#COPY ./install-opencv3.sh /tmp/
20+
21+
# this is needed as libfaac-dev comes from multiverse, according to:
22+
# http://superuser.com/questions/467774/how-to-install-libfaac-dev
23+
RUN echo "deb http://us.archive.ubuntu.com/ubuntu/ precise multiverse\n\
24+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise multiverse\n\
25+
deb http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse\n\
26+
deb-src http://us.archive.ubuntu.com/ubuntu/ precise-updates multiverse\n"\
27+
>> /etc/apt/sources.list
28+
29+
30+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
31+
software-properties-common
32+
RUN add-apt-repository ppa:george-edison55/cmake-3.x
33+
RUN apt-get update -qq
34+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
35+
curl \
36+
cmake \
37+
wget \
38+
unzip \
39+
libopencv-dev \
40+
build-essential \
41+
git \
42+
libgtk2.0-dev \
43+
pkg-config \
44+
python-dev \
45+
python-numpy \
46+
libdc1394-22 \
47+
libdc1394-22-dev \
48+
libjpeg-dev \
49+
libpng12-dev \
50+
libtiff4-dev \
51+
libjasper-dev \
52+
libavcodec-dev \
53+
libavformat-dev \
54+
libswscale-dev \
55+
libxine-dev \
56+
libgstreamer0.10-dev \
57+
libgstreamer-plugins-base0.10-dev \
58+
libv4l-dev \
59+
libtbb-dev \
60+
libqt4-dev \
61+
libfaac-dev \
62+
libmp3lame-dev \
63+
libopencore-amrnb-dev \
64+
libopencore-amrwb-dev \
65+
libtheora-dev \
66+
libvorbis-dev \
67+
libxvidcore-dev \
68+
x264 \
69+
v4l-utils
70+
71+
RUN mkdir opencv
72+
WORKDIR opencv
73+
74+
RUN wget https://github.com/Itseez/opencv/archive/3.0.0.zip -O opencv-3.0.0.zip
75+
RUN unzip opencv-3.0.0.zip
76+
RUN mkdir opencv-3.0.0/build
77+
WORKDIR opencv-3.0.0/build
78+
79+
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 ..
80+
81+
RUN make -j $(nproc) && make install
82+
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf
83+
RUN ldconfig

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,9 @@ release:
3333
@echo "Publishing to NPM"
3434
@npm publish
3535
.PHONY: release
36+
37+
38+
travis-build:
39+
docker build -t peterbraden/node-opencv-ubuntu-12-04 -f test/Dockerfile-ubuntu-12-04 .
40+
docker build -t peterbraden/node-opencv-ubuntu-14-04 -f test/Dockerfile-ubuntu-14-04 .
41+
.PHONY: travis-build

examples/salt.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*
12
var cv = require('../lib/opencv');
23
34
cv.readImage("./files/mona.png", function(err, im) {
@@ -18,3 +19,4 @@ function salt(img, n) {
1819
img.set(y, x, 255);
1920
}
2021
}
22+
*/

test/Dockerfile-ubuntu-12-04

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This is a dockerfile to test the build on ubuntu 12.04
2+
from ubuntu:12.04
3+
run apt-get update -qq
4+
run apt-get install -y software-properties-common python-software-properties
5+
run add-apt-repository -y ppa:kubuntu-ppa/backports
6+
run apt-get update
7+
run apt-get install -y libcv-dev libcvaux-dev libhighgui-dev libopencv-dev
8+
run curl -sL https://deb.nodesource.com/setup | bash -
9+
run apt-get install -y nodejs
10+
WORKDIR /root/node-opencv
11+
add . /root/node-opencv
12+
run npm install --unsafe-perm --build-from-source || cat npm-debug.log
13+
run make test

test/Dockerfile-ubuntu-14-04

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This is a dockerfile to test the build on ubuntu 14.04
2+
from ubuntu:14.04
3+
run apt-get update -qq
4+
run apt-get install -y software-properties-common python-software-properties
5+
run add-apt-repository -y ppa:kubuntu-ppa/backports
6+
run apt-get update
7+
run apt-get install -y libcv-dev libcvaux-dev libhighgui-dev libopencv-dev
8+
run curl -sL https://deb.nodesource.com/setup | bash -
9+
run apt-get install -y nodejs
10+
WORKDIR /root/node-opencv
11+
add . /root/node-opencv
12+
run npm install --unsafe-perm --build-from-source || cat npm-debug.log
13+
run make test

0 commit comments

Comments
 (0)