-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.ubuntu22.04
113 lines (105 loc) · 3.76 KB
/
Dockerfile.ubuntu22.04
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
109
110
111
112
113
ARG CUDA="12.2.2"
ARG UBUNTU="22.04"
ARG ARCH=""
FROM nvidia/cuda${ARCH}:${CUDA}-devel-ubuntu${UBUNTU}
ARG NVIDIA_DISTRO="ubuntu2204/x86_64"
ARG OPENCV="4.9.0"
ARG CUDA_ARCH_BIN="5.0;5.2;5.3;6.0;6.1;6.2;7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0"
ARG CUDA_ARCH_PTX=""
ARG CUDNN="OFF"
ARG VIDEO_CODEC_SDK="12.1.14"
ARG VIDEO_CODEC_SDK_PATH="video_codec_sdk"
ENV DEBIAN_FRONTEND=noninteractive
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video
RUN apt update && apt install -y --no-install-recommends build-essential \
cmake \
gcc g++ \
ninja-build \
gdb \
git \
wget \
unzip \
yasm \
doxygen \
pkg-config \
checkinstall \
libatlas-base-dev \
gfortran \
libflann-dev \
libglew-dev \
libgdal-dev \
libeigen3-dev \
libgflags-dev \
libgoogle-glog-dev \
libprotobuf-dev \
protobuf-compiler \
python3 python3-dev python3-numpy \
libleptonica-dev \
libtesseract-dev \
liblapack-dev \
libhdf5-serial-dev \
# GUI
qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools \
libgtk-3-dev libgtk2.0-dev \
libvtk9-dev \
# media io
zlib1g-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev libtiff5-dev \
# video i/o
libdc1394-dev \
ffmpeg \
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev \
libgstreamer1.0-0 libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav \
gir1.2-gst-rtsp-server-1.0 gstreamer1.0-rtsp gstreamer1.0-plugins-base-apps \
libv4l-dev \
# parallel framework
libtbb-dev libtbb2
WORKDIR /tmp
# Copy Video Codec SDK and create symbolic link
ADD ${VIDEO_CODEC_SDK_PATH}/Video_Codec_SDK_${VIDEO_CODEC_SDK}.zip /tmp
RUN unzip Video_Codec_SDK_${VIDEO_CODEC_SDK}.zip && rm Video_Codec_SDK_${VIDEO_CODEC_SDK}.zip
RUN cp /tmp/Video_Codec_SDK_${VIDEO_CODEC_SDK}/Interface/* /usr/local/cuda/include/
# Copy libs for build image
RUN cp /tmp/Video_Codec_SDK_${VIDEO_CODEC_SDK}/Lib/linux/stubs/x86_64/* /usr/lib/x86_64-linux-gnu/ && \
ln -s /usr/lib/x86_64-linux-gnu/libnvcuvid.so /usr/lib/x86_64-linux-gnu/libnvcuvid.so.1 && \
ln -s /usr/lib/x86_64-linux-gnu/libnvidia-encode.so /usr/lib/x86_64-linux-gnu/libnvidia-encode.so.1 && \
ln -s /usr/lib/x86_64-linux-gnu/libnvcuvid.so.1 /usr/local/cuda/lib64/libnvcuvid.so && \
ln -s /usr/lib/x86_64-linux-gnu/libnvidia-encode.so.1 /usr/local/cuda/lib64/libnvidia-encode.so
RUN wget https://github.com/opencv/opencv/archive/refs/tags/${OPENCV}.zip && unzip ${OPENCV}.zip && rm ${OPENCV}.zip
RUN wget https://github.com/opencv/opencv_contrib/archive/${OPENCV}.zip && unzip ${OPENCV}.zip && rm ${OPENCV}.zip
RUN mkdir opencv-${OPENCV}/build && \
cd opencv-${OPENCV}/build && \
cmake -GNinja \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs \
-DWITH_CUDA=ON \
-DWITH_NVCUVID=ON \
-DWITH_CUDNN=${CUDNN} \
-DWITH_CUBLAS=ON \
-DWITH_TBB=ON \
-DWITH_QT=ON \
-DENABLE_FAST_MATH=ON \
-DCUDA_FAST_MATH=ON \
-DCUDA_ARCH_BIN=${CUDA_ARCH_BIN} \
-DCUDA_ARCH_PTX=${CUDA_ARCH_PTX} \
-DOPENCV_EXTRA_MODULES_PATH=/tmp/opencv_contrib-${OPENCV}/modules \
-DOPENCV_DNN_CUDA=${CUDNN} \
-DOPENCV_ENABLE_NONFREE=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_JAVA=OFF \
-DBUILD_opencv_apps=ON \
-DBUILD_opencv_python2=OFF \
-DBUILD_opencv_python3=ON \
.. && \
ninja && \
ninja install && \
ldconfig
RUN rm -rf /tmp/* && rm -rf /var/lib/apt/lists/*