-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
108 lines (84 loc) · 2.97 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Container build parameters
# `docker build --tag kinect-opencv-face-detect .`
# Must allow Docker to access the host's X11 server (lasts until reboot)
# `xhost +local:docker`
# Container run parameters (headed)
# `docker run --device /dev/snd --env DISPLAY --interactive --net host --privileged --rm --tty kinect-opencv-face-detect`
# Container run parameters (headless)
# `docker run --device /dev/snd --env DISPLAY --interactive --net host --privileged --rm --tty kinect-opencv-face-detect /build/head_hunter 1`
ARG DEBIAN_FRONTEND=noninteractive
ARG GIT_TAG_LIBFREENECT="v0.6.0"
ARG GIT_TAG_OPENCV="4.3.0"
# Base Image
FROM debian:10-slim
# Pull in global args
ARG DEBIAN_FRONTEND
ARG GIT_TAG_LIBFREENECT
ARG GIT_TAG_OPENCV
# Install environmental dependencies
RUN ["dash", "-c" ,"\
apt-get update \
&& apt-get install --no-install-recommends --show-progress --verbose-versions --yes \
ca-certificates \
nano \
udev \
"]
# Install `libfreenect` build dependencies
# https://github.com/OpenKinect/libfreenect#linux
RUN ["dash", "-c" ,"\
apt-get install --no-install-recommends --show-progress --verbose-versions --yes \
build-essential \
cmake \
git \
libusb-1.0-0-dev \
"]
# Install `libfreenect` example dependencies
RUN ["dash", "-c" ,"\
apt-get install --no-install-recommends --show-progress --verbose-versions --yes \
freeglut3-dev \
libxi-dev \
libxmu-dev \
"]
# Install `opencv` build dependencies
RUN ["dash", "-c" ,"\
apt-get install --no-install-recommends --show-progress --verbose-versions --yes \
build-essential \
cmake \
git \
libavcodec-dev \
libavformat-dev \
libgtk2.0-dev \
libswscale-dev \
pkg-config \
"]
# Install application dependencies
RUN ["dash", "-c" ,"\
apt-get install --no-install-recommends --show-progress --verbose-versions --yes \
libcanberra-gtk-module \
&& rm -rf /var/lib/apt/lists \
"]
WORKDIR /src
# Clone `OpenKinect/libfreenect` git repository
RUN git clone https://github.com/OpenKinect/libfreenect.git --recursive --branch ${GIT_TAG_LIBFREENECT}
# Clone `OpenCV` git repository
RUN git clone https://github.com/opencv/opencv.git --recursive --branch ${GIT_TAG_OPENCV}
# Copy udev rules
RUN ["cp", "--no-clobber", "/src/libfreenect/platform/linux/udev/51-kinect.rules", "/etc/udev/rules.d/"]
WORKDIR /build/libfreenect
# Generate `libfreenect` build system
RUN ["cmake", "/src/libfreenect"]
# Build `libfreenect`
RUN ["make", "all", "install", "--directory=/build/libfreenect"]
WORKDIR /build/opencv
# Generate `opencv` build system
RUN ["cmake", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=/usr/local", "/src/opencv"]
# Build `opencv`
RUN ["make", "all", "install", "--directory=/build/opencv", "-j7"]
ENV LD_LIBRARY_PATH=/usr/local/lib
WORKDIR /build
COPY Makefile .
COPY kinect_opencv_face_detect.cpp .
# Build Head Hunter
RUN ["make", "all"]
# Launch as headed application (headless == 0)
CMD ["/build/head_hunter", "0"]