-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (39 loc) · 1.45 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
ARG BASE_IMAGE_VERSION="bionic"
ARG OPENCV_VERSION="2.4.13.6"
FROM ubuntu:$BASE_IMAGE_VERSION AS builder
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential cmake git pkg-config wget unzip ca-certificates \
libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev
WORKDIR /tmp/opencv-build
RUN wget https://github.com/opencv/opencv/archive/$OPENCV_VERSION.zip && \
unzip $OPENCV_VERSION.zip
RUN cd opencv-$OPENCV_VERSION && \
mkdir build && cd build && \
cmake \
-DWITH_TBB=ON \
-DWITH_OPENCL=ON \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DENABLE_PRECOMPILED_HEADERS=OFF \
.. && \
make -j$(nproc) && \
mkdir /destdir && make DESTDIR=/destdir install && \
rm -rf /tmp/opencv-build
WORKDIR /destdir
FROM ubuntu:$BASE_IMAGE_VERSION
MAINTAINER Roman Khotsyn <[email protected]>
WORKDIR /
# List of packages depends on actual outcome of the previous step
# Script to retrieve packages with runtime dependencies:
#
# find /destdir -executable -type f -o -name "*.so*" | \
# xargs ldd | cut -d' ' -f3 | grep -v "opencv" | grep ".so." | sort -u | \
# xargs dpkg -S | cut -d':' -f1,2 | sort -u | paste -sd " "
#
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libc6 libgcc1 libstdc++6 libjbig0 libjpeg-turbo8 \
liblzma5 libpng16-16 libtbb2 libtiff5 zlib1g
COPY --from=builder /destdir /