Update Dockerfile to include FFmpeg 8.0 installation with shared libraries and set LD_LIBRARY_PATH for runtime compatibility.

This commit is contained in:
vegu-ai-tools
2025-12-05 19:59:41 +02:00
parent 974786a2ef
commit e06ded8ff4

View File

@@ -38,13 +38,16 @@ COPY ./src /app/src
# Create virtual environment and install dependencies (includes CUDA support via pyproject.toml)
RUN uv sync
# Stage 3: Final image
# Stage 4: Final image
FROM python:3.11-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
bash \
wget \
tar \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Install uv in the final stage
@@ -53,6 +56,19 @@ RUN pip install uv
# Copy virtual environment from backend-build stage
COPY --from=backend-build /app/.venv /app/.venv
# Download and install FFmpeg 8.0 with shared libraries into .venv (matching Windows installer approach)
# Using BtbN FFmpeg builds which provide shared libraries
RUN cd /tmp && \
wget -q https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl-shared.tar.xz -O ffmpeg.tar.xz && \
tar -xf ffmpeg.tar.xz && \
cp -a ffmpeg-master-latest-linux64-gpl-shared/bin/* /app/.venv/bin/ && \
cp -a ffmpeg-master-latest-linux64-gpl-shared/lib/* /app/.venv/lib/ && \
rm -rf ffmpeg-master-latest-linux64-gpl-shared ffmpeg.tar.xz && \
/app/.venv/bin/ffmpeg -version | head -n 1
# Set LD_LIBRARY_PATH so torchcodec can find ffmpeg libraries at runtime
ENV LD_LIBRARY_PATH=/app/.venv/lib:${LD_LIBRARY_PATH}
# Copy Python source code
COPY --from=backend-build /app/src /app/src