refactor: update Dockerfile to use development image and enhance FFmpeg build process with NVIDIA support
Some checks failed
Build Worker Base and Application Images / check-base-changes (push) Successful in 7s
Build Worker Base and Application Images / build-docker (push) Has been cancelled
Build Worker Base and Application Images / deploy-stack (push) Has been cancelled
Build Worker Base and Application Images / build-base (push) Has been cancelled

This commit is contained in:
Siwat Sirichai 2025-09-26 00:48:06 +07:00
parent e2e5356047
commit 6fe4b6ebf0

View file

@ -1,5 +1,5 @@
# Base image with complete ML and hardware acceleration stack # Base image with complete ML and hardware acceleration stack
FROM pytorch/pytorch:2.8.0-cuda12.6-cudnn9-runtime FROM pytorch/pytorch:2.8.0-cuda12.6-cudnn9-devel
# Install build dependencies and system libraries # Install build dependencies and system libraries
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
@ -12,6 +12,12 @@ RUN apt-get update && apt-get install -y \
unzip \ unzip \
yasm \ yasm \
nasm \ nasm \
# Additional dependencies for FFmpeg/NVIDIA build
libtool \
libc6 \
libc6-dev \
libnuma1 \
libnuma-dev \
# System libraries # System libraries
libgl1-mesa-glx \ libgl1-mesa-glx \
libglib2.0-0 \ libglib2.0-0 \
@ -31,41 +37,45 @@ RUN apt-get update && apt-get install -y \
python3-numpy \ python3-numpy \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install prebuilt FFmpeg with CUDA support # CUDA development tools already available in devel image
# Ensure CUDA paths are available # Ensure CUDA paths are available
ENV PATH="/usr/local/cuda/bin:${PATH}" ENV PATH="/usr/local/cuda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}" ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
# Install NVIDIA Video Codec SDK headers first # Install NVIDIA Video Codec SDK headers (official method)
RUN cd /tmp && \ RUN cd /tmp && \
wget https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n12.1.14.0.zip && \ git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git && \
unzip n12.1.14.0.zip && \ cd nv-codec-headers && \
cd nv-codec-headers-n12.1.14.0 && \
make install && \ make install && \
rm -rf /tmp/* cd / && rm -rf /tmp/*
# Build FFmpeg from source with NVIDIA CUDA support # Build FFmpeg from source with NVIDIA CUDA support
RUN cd /tmp && \ RUN cd /tmp && \
echo "Building FFmpeg with NVIDIA CUDA support..." && \ echo "Building FFmpeg with NVIDIA CUDA support..." && \
# Download FFmpeg source # Download FFmpeg source (official method)
wget https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz && \ git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/ && \
tar -xf ffmpeg-7.1.tar.xz && \ cd ffmpeg && \
cd ffmpeg-7.1 && \ # Configure with NVIDIA support (following official NVIDIA documentation)
# Configure with NVIDIA support
./configure \ ./configure \
--prefix=/usr/local \ --prefix=/usr/local \
--enable-shared \ --enable-shared \
--enable-pic \ --disable-static \
--enable-gpl \
--enable-version3 \
--enable-nonfree \ --enable-nonfree \
--enable-gpl \
--enable-cuda-nvcc \ --enable-cuda-nvcc \
--enable-cuda-llvm \
--enable-cuvid \ --enable-cuvid \
--enable-nvdec \ --enable-nvdec \
--enable-nvenc \ --enable-nvenc \
--enable-libnpp \ --enable-libnpp \
--nvcc=/usr/local/cuda/bin/nvcc \
--extra-cflags=-I/usr/local/cuda/include \ --extra-cflags=-I/usr/local/cuda/include \
--extra-ldflags=-L/usr/local/cuda/lib64 \ --extra-ldflags=-L/usr/local/cuda/lib64 \
--extra-libs=-lcuda \
--extra-libs=-lcudart \
--extra-libs=-lnvcuvid \
--extra-libs=-lnvidia-encode \
--enable-libx264 \ --enable-libx264 \
--enable-libx265 \ --enable-libx265 \
--enable-libvpx \ --enable-libvpx \