тест
· 6.3 KiB · Text
Raw
Вот мой Dockerfile
FROM registry.red-soft.ru/ubi8/python-311:latest
# Переключаемся на root для установки системных пакетов
USER root
# Устанавливаем dnf-plugins-core для управления репозиториями
RUN dnf install -y dnf-plugins-core
# Включаем репозиторий Codeready Builder (содержит dev-пакеты в UBI)
#RUN dnf config-manager --set-enabled ubi-8-codeready-builder
# Установка зависимостей сборки, инструментов и запрошенных системных библиотек
# Примечание: названия пакетов адаптированы под RHEL 8 / UBI 8:
# libusb-1.0-0 -> libusb1
# libglib2.0-0 -> glib2
# libgl1-mesa-glx -> mesa-libGL
# libgomp1 -> libgomp
RUN dnf install -y \
gcc gcc-c++ make cmake git pkgconfig \
python3.11-devel \
libusb1 glib2 mesa-libGL libgomp net-tools \
nasm yasm wget curl \
&& dnf clean all
# Добавляем официальный репозиторий NVIDIA CUDA и устанавливаем CUDA Toolkit (12.4)
RUN dnf config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo \
&& dnf install -y cuda-toolkit-12-4 \
&& dnf clean all
ENV PATH=/usr/local/cuda/bin:$PATH
#ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
#ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
# Установка Python-библиотеки harvesters
RUN pip install --no-cache-dir harvesters numpy
# ==========================================================
# Сборка FFmpeg с поддержкой NVIDIA (cuvid, nvenc, nvdec)
# ==========================================================
# 2. Скачайте и установите ffnvcodec-headers
RUN dnf install -y make git pkgconfig nasm yasm autoconf automake gcc gcc-c++
RUN git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git /tmp/nv-codec-headers \
&& cd /tmp/nv-codec-headers \
&& make \
&& make install PREFIX=/usr/local \
&& cd / \
&& export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH
RUN 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
# ==========================================================
# Сборка OpenCV с поддержкой CUDA
# ==========================================================
RUN git clone --depth 1 https://github.com/opencv/opencv.git /tmp/opencv \
&& git clone --depth 1 https://github.com/opencv/opencv_contrib.git /tmp/opencv_contrib \
&& mkdir -p /tmp/opencv/build && cd /tmp/opencv/build \
&& cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D PYTHON3_EXECUTABLE=/usr/bin/python3.11 \
-D WITH_CUDA=ON \
-D CUDA_ARCH_BIN=5.2,6.0,6.1,7.0,7.5,8.0,8.6,8.9,9.0 \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D WITH_CUBLAS=ON \
-D OPENCV_DNN_CUDA=ON \
-D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv_contrib/modules \
-D BUILD_opencv_python3=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_EXAMPLES=OFF \
.. \
&& make -j$(nproc) \
&& make install \
&& ldconfig \
&& rm -rf /tmp/opencv /tmp/opencv_contrib
# Очистка инструментов сборки для уменьшения размера образа
RUN dnf remove -y gcc gcc-c++ make cmake nasm yasm wget curl git \
&& dnf clean all \
&& pip cache purge
ENV PYTHONUNBUFFERED=1
# Возврат к стандартному non-root пользователю UBI
USER 1001
WORKDIR /app
CMD ["python3", "-c", "app.py"]
У меня возникает следующая ошибка
12.34 ERROR: cuvid requested, but not all dependencies are satisfied: ffnvcodec
12.35
12.35 If you think configure made a mistake, make sure you are using the latest
12.35 version from Git. If the latest version fails, report the problem to the
12.35 ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
12.35 Include the log file "ffbuild/config.log" produced by configure as this will help
12.35 solve the problem.
------
Dockerfile:52
--------------------
51 |
52 | >>> RUN git clone --depth 1 https://github.com/FFmpeg/FFmpeg.git /tmp/ffmpeg \
53 | >>> && cd /tmp/ffmpeg \
54 | >>> && ./configure \
55 | >>> --prefix=/usr/local \
56 | >>> --enable-cuda-nvcc \
57 | >>> --enable-cuvid \
58 | >>> --enable-nvenc \
59 | >>> --enable-nvdec \
60 | >>> --extra-cflags="-I/usr/local/include" \
61 | >>> --extra-ldflags="-L/usr/local/lib64" \
62 | >>> --enable-gpl \
63 | >>> --enable-nonfree \
64 | >>> --enable-shared \
65 | >>> --extra-cflags="-I/usr/local/cuda/include" \
66 | >>> --extra-ldflags="-L/usr/local/cuda/lib64" \
67 | >>> && make -j$(nproc) \
68 | >>> && make install \
69 | >>> && ldconfig \
70 | >>> && rm -rf /tmp/ffmpeg
71 |
--------------------
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
| 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 |