Last active 6 months ago

drholy revised this gist 6 months ago. Go to revision

1 file changed, 145 insertions

тест(file created)

@@ -0,0 +1,145 @@
1 + Вот мой Dockerfile
2 + FROM registry.red-soft.ru/ubi8/python-311:latest
3 +
4 +
5 + # Переключаемся на root для установки системных пакетов
6 + USER root
7 +
8 + # Устанавливаем dnf-plugins-core для управления репозиториями
9 + RUN dnf install -y dnf-plugins-core
10 +
11 + # Включаем репозиторий Codeready Builder (содержит dev-пакеты в UBI)
12 + #RUN dnf config-manager --set-enabled ubi-8-codeready-builder
13 +
14 + # Установка зависимостей сборки, инструментов и запрошенных системных библиотек
15 + # Примечание: названия пакетов адаптированы под RHEL 8 / UBI 8:
16 + # libusb-1.0-0 -> libusb1
17 + # libglib2.0-0 -> glib2
18 + # libgl1-mesa-glx -> mesa-libGL
19 + # libgomp1 -> libgomp
20 + RUN dnf install -y \
21 + gcc gcc-c++ make cmake git pkgconfig \
22 + python3.11-devel \
23 + libusb1 glib2 mesa-libGL libgomp net-tools \
24 + nasm yasm wget curl \
25 + && dnf clean all
26 +
27 + # Добавляем официальный репозиторий NVIDIA CUDA и устанавливаем CUDA Toolkit (12.4)
28 + RUN dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo \
29 + && dnf install -y cuda-toolkit-12-4 \
30 + && dnf clean all
31 +
32 + ENV PATH=/usr/local/cuda/bin:$PATH
33 + #ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
34 + #ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
35 +
36 + # Установка Python-библиотеки harvesters
37 + RUN pip install --no-cache-dir harvesters numpy
38 +
39 + # ==========================================================
40 + # Сборка FFmpeg с поддержкой NVIDIA (cuvid, nvenc, nvdec)
41 + # ==========================================================
42 +
43 + # 2. Скачайте и установите ffnvcodec-headers
44 + RUN dnf install -y make git pkgconfig nasm yasm autoconf automake gcc gcc-c++
45 +
46 + RUN git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git /tmp/nv-codec-headers \
47 + && cd /tmp/nv-codec-headers \
48 + && make \
49 + && make install PREFIX=/usr/local \
50 + && cd / \
51 + && export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH
52 +
53 + RUN git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git /tmp/ffmpeg \
54 + && cd /tmp/ffmpeg \
55 + && ./configure \
56 + --prefix=/usr/local \
57 + --enable-cuda-nvcc \
58 + --enable-cuvid \
59 + --enable-nvenc \
60 + --enable-nvdec \
61 + --extra-cflags="-I/usr/local/include" \
62 + --extra-ldflags="-L/usr/local/lib64" \
63 + --enable-gpl \
64 + --enable-nonfree \
65 + --enable-shared \
66 + --extra-cflags="-I/usr/local/cuda/include" \
67 + --extra-ldflags="-L/usr/local/cuda/lib64" \
68 + && make -j$(nproc) \
69 + && make install \
70 + && ldconfig \
71 + && rm -rf /tmp/ffmpeg
72 +
73 + # ==========================================================
74 + # Сборка OpenCV с поддержкой CUDA
75 + # ==========================================================
76 + RUN git clone --depth 1 https://github.com/opencv/opencv.git /tmp/opencv \
77 + && git clone --depth 1 https://github.com/opencv/opencv_contrib.git /tmp/opencv_contrib \
78 + && mkdir -p /tmp/opencv/build && cd /tmp/opencv/build \
79 + && cmake -D CMAKE_BUILD_TYPE=RELEASE \
80 + -D CMAKE_INSTALL_PREFIX=/usr/local \
81 + -D PYTHON3_EXECUTABLE=/usr/bin/python3.11 \
82 + -D WITH_CUDA=ON \
83 + -D CUDA_ARCH_BIN=5.2,6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0 \
84 + -D ENABLE_FAST_MATH=ON \
85 + -D CUDA_FAST_MATH=ON \
86 + -D WITH_CUBLAS=ON \
87 + -D OPENCV_DNN_CUDA=ON \
88 + -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv_contrib/modules \
89 + -D BUILD_opencv_python3=ON \
90 + -D BUILD_TESTS=OFF \
91 + -D BUILD_PERF_TESTS=OFF \
92 + -D BUILD_EXAMPLES=OFF \
93 + .. \
94 + && make -j$(nproc) \
95 + && make install \
96 + && ldconfig \
97 + && rm -rf /tmp/opencv /tmp/opencv_contrib
98 +
99 + # Очистка инструментов сборки для уменьшения размера образа
100 + RUN dnf remove -y gcc gcc-c++ make cmake nasm yasm wget curl git \
101 + && dnf clean all \
102 + && pip cache purge
103 +
104 + ENV PYTHONUNBUFFERED=1
105 +
106 + # Возврат к стандартному non-root пользователю UBI
107 + USER 1001
108 + WORKDIR /app
109 +
110 + CMD ["python3", "-c", "app.py"]
111 +
112 + У меня возникает следующая ошибка
113 + 12.34 ERROR: cuvid requested, but not all dependencies are satisfied: ffnvcodec
114 + 12.35
115 + 12.35 If you think configure made a mistake, make sure you are using the latest
116 + 12.35 version from Git. If the latest version fails, report the problem to the
117 + 12.35 ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
118 + 12.35 Include the log file "ffbuild/config.log" produced by configure as this will help
119 + 12.35 solve the problem.
120 + ------
121 + Dockerfile:52
122 + --------------------
123 + 51 |
124 + 52 | >>> RUN git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git /tmp/ffmpeg \
125 + 53 | >>> && cd /tmp/ffmpeg \
126 + 54 | >>> && ./configure \
127 + 55 | >>> --prefix=/usr/local \
128 + 56 | >>> --enable-cuda-nvcc \
129 + 57 | >>> --enable-cuvid \
130 + 58 | >>> --enable-nvenc \
131 + 59 | >>> --enable-nvdec \
132 + 60 | >>> --extra-cflags="-I/usr/local/include" \
133 + 61 | >>> --extra-ldflags="-L/usr/local/lib64" \
134 + 62 | >>> --enable-gpl \
135 + 63 | >>> --enable-nonfree \
136 + 64 | >>> --enable-shared \
137 + 65 | >>> --extra-cflags="-I/usr/local/cuda/include" \
138 + 66 | >>> --extra-ldflags="-L/usr/local/cuda/lib64" \
139 + 67 | >>> && make -j$(nproc) \
140 + 68 | >>> && make install \
141 + 69 | >>> && ldconfig \
142 + 70 | >>> && rm -rf /tmp/ffmpeg
143 + 71 |
144 + --------------------
145 + ERROR: failed to build: failed to solve: process "/bin/sh -c git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git /tmp/ffmpeg && cd /tmp/ffmpeg && ./configure --prefix=/usr/local --enable-cuda-nvcc --enable-cuvid --enable-nvenc --enable-nvdec --extra-cflags=\"-I/usr/local/include\" --extra-ldflags=\"-L/usr/local/lib64\" --enable-gpl --enable-nonfree --enable-shared --extra-cflags=\"-I/usr/local/cuda/include\" --extra-ldflags=\"-L/usr/local/cuda/lib64\" && make -j$(nproc) && make install && ldconfig && rm -rf /tmp/ffmpeg" did not complete successfully: exit code: 1
Newer Older