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
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
RUN apt-get update && apt-get install -y \
@ -12,6 +12,12 @@ RUN apt-get update && apt-get install -y \
unzip \
yasm \
nasm \
# Additional dependencies for FFmpeg/NVIDIA build
libtool \
libc6 \
libc6-dev \
libnuma1 \
libnuma-dev \
# System libraries
libgl1-mesa-glx \
libglib2.0-0 \
@ -31,41 +37,45 @@ RUN apt-get update && apt-get install -y \
python3-numpy \
&& 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
ENV PATH="/usr/local/cuda/bin:${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 && \
wget https://github.com/FFmpeg/nv-codec-headers/archive/refs/tags/n12.1.14.0.zip && \
unzip n12.1.14.0.zip && \
cd nv-codec-headers-n12.1.14.0 && \
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git && \
cd nv-codec-headers && \
make install && \
rm -rf /tmp/*
cd / && rm -rf /tmp/*
# Build FFmpeg from source with NVIDIA CUDA support
RUN cd /tmp && \
echo "Building FFmpeg with NVIDIA CUDA support..." && \
# Download FFmpeg source
wget https://ffmpeg.org/releases/ffmpeg-7.1.tar.xz && \
tar -xf ffmpeg-7.1.tar.xz && \
cd ffmpeg-7.1 && \
# Configure with NVIDIA support
# Download FFmpeg source (official method)
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg/ && \
cd ffmpeg && \
# Configure with NVIDIA support (following official NVIDIA documentation)
./configure \
--prefix=/usr/local \
--enable-shared \
--enable-pic \
--enable-gpl \
--enable-version3 \
--disable-static \
--enable-nonfree \
--enable-gpl \
--enable-cuda-nvcc \
--enable-cuda-llvm \
--enable-cuvid \
--enable-nvdec \
--enable-nvenc \
--enable-libnpp \
--nvcc=/usr/local/cuda/bin/nvcc \
--extra-cflags=-I/usr/local/cuda/include \
--extra-ldflags=-L/usr/local/cuda/lib64 \
--extra-libs=-lcuda \
--extra-libs=-lcudart \
--extra-libs=-lnvcuvid \
--extra-libs=-lnvidia-encode \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \