-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.dev
74 lines (67 loc) · 4.11 KB
/
Dockerfile.dev
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
# BASE image
ARG BASE_IMAGE=ubuntu-toolbox:24.04-cuda12.2
FROM ${BASE_IMAGE}
# FFMPEG and OpenCV versions
ARG CUDA_ARCH_BIN=8.6
ARG OPENCV_RELEASE=4.9.0
ARG FFMPEG_RELEASE=7.0
ARG VIDEOSDK_RELEASE=12.2.72.0
WORKDIR /opt/workspace
# Build depedencies
RUN apt-get update && \
apt-get install -y build-essential autoconf automake \
cmake git-core libass-dev libfreetype6-dev libgnutls28-dev \
libgtk-3-dev libsdl2-dev gfortran python3-dev python3-numpy python3-pip \
libtool libva-dev libvorbis-dev libopus-dev libpulse-dev \
libjpeg-dev libpng-dev libtiff-dev libv4l-dev libatlas-base-dev \
libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev pkg-config libc6-dev \
texinfo wget yasm nasm zlib1g-dev libx264-dev libx265-dev libnuma-dev flex bison libssl-dev && \
wget https://github.com/FFmpeg/nv-codec-headers/archive/n${VIDEOSDK_RELEASE}.tar.gz -O nv-codec-headers.tar.gz && \
tar -zxvf nv-codec-headers.tar.gz && cd nv-codec-headers-n${VIDEOSDK_RELEASE} && \
make install && cd .. && \
rm -rf nv-codec-headers-n${VIDEOSDK_RELEASE}/ nv-codec-headers.tar.gz && \
apt clean && rm -rd /var/lib/apt/lists/*
# Compile FFmpeg
RUN wget https://ffmpeg.org/releases/ffmpeg-${FFMPEG_RELEASE}.tar.gz -O ffmpeg.tar.gz && \
tar -zxvf ffmpeg.tar.gz && cd ffmpeg-${FFMPEG_RELEASE} && \
. /etc/profile.d/cuda.sh && \
./configure --enable-nonfree --enable-cuda-nvcc --nvccflags="-gencode arch=compute_$( echo -n ${CUDA_ARCH_BIN} | tr -d '.'),code=sm_$(echo -n ${CUDA_ARCH_BIN} | tr -d '.') -O2" \
--enable-nvdec --enable-nvenc --enable-libnpp --extra-cflags="-I/usr/local/cuda/include" --extra-ldflags="-L/usr/local/cuda/lib64" \
--enable-gpl --enable-gnutls --enable-libass --enable-libopus --enable-libvorbis \
--enable-libx264 --enable-libx265 --enable-shared --enable-static --enable-libpulse ; cat ffbuild/config.log && \
make -j$(nproc --ignore=4) && make install && ldconfig && make clean && \
cd .. && rm -rf FFmpeg-n${FFMPEG_RELEASE} ffmpeg.tar.gz
# Compile OpenCV
RUN wget https://github.com/opencv/opencv/archive/${OPENCV_RELEASE}.tar.gz -O opencv.tar.gz && \
wget https://github.com/opencv/opencv_contrib/archive/${OPENCV_RELEASE}.tar.gz -O opencv_contrib.tar.gz && \
tar -zxvf opencv.tar.gz && tar -zxvf opencv_contrib.tar.gz && \
mkdir opencv-${OPENCV_RELEASE}/build && cd opencv-${OPENCV_RELEASE}/build && \
. /etc/profile.d/cuda.sh && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_ENABLE_NONFREE=ON -D ENABLE_FAST_MATH=1 \
-D INSTALL_PYTHON_EXAMPLES=OFF -D INSTALL_C_EXAMPLES=OFF \
-D WITH_CUDA=ON -D WITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D CUDA_FAST_MATH=1 \
# -D CUDA_cublas_LIBRARY=/usr/local/cuda-10.2/lib64/libcublas.so \
-D BUILD_opencv_cudacodec=OFF -D BUILD_opencv_cudalegacy=OFF -D BUILD_opencv_java_bindings_generator=OFF \
-D CUDA_ARCH_BIN=${CUDA_ARCH_BIN} -D WITH_CUBLAS=1 -D OPENCV_EXTRA_MODULES_PATH=/opt/workspace/opencv_contrib-${OPENCV_RELEASE}/modules \
-D HAVE_opencv_python3=ON -D PYTHON_EXECUTABLE=/usr/bin/python3 .. && \
make -j$(nproc --ignore=4) && make install && make clean && \
cd ../.. && \
rm -rf opencv.tar.gz opencv_contrib.tar.gz opencv-${OPENCV_RELEASE}/ opencv_contrib-${OPENCV_RELEASE}/
# Other utilities
RUN apt-get update && \
apt-get install -y \
crossbuild-essential-armhf crossbuild-essential-arm64 \
ruby ruby-dev rubygems gzip bzip2 rsync perl cpio bc libncurses5-dev \
device-tree-compiler jq quilt pulsemixer mosquitto-clients pahole flex bison libssl-dev \
# Git libsecret credential helper
libsecret-1-0 libsecret-1-dev libglib2.0-dev \
# VSCode auxiliar components
gnome-keyring desktop-file-utils x11-utils \
# Gstreamer
gstreamer1.0-tools gstreamer1.0-rtsp gstreamer1.0-alsa gstreamer1.0-pulseaudio gstreamer1.0-vaapi \
gstreamer1.0-plugins-good gstreamer1.0-gl gstreamer1.0-plugins-rtp gstreamer1.0-plugins-bad \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev libgstrtspserver-1.0-dev && \
gem install --no-document fpm:1.11.0 && \
apt clean && rm -rd /var/lib/apt/lists/*