- Build decord with -DUSE_CUDA=ON for true NVDEC hardware decode - Use DLPack for zero-copy transfer from decord to CuPy - Frames stay on GPU throughout: decode -> process -> encode Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
62 lines
1.8 KiB
Docker
62 lines
1.8 KiB
Docker
# GPU-enabled worker image
|
|
# Based on NVIDIA CUDA with Python for CuPy support
|
|
|
|
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
|
|
|
|
WORKDIR /app
|
|
|
|
# Install Python 3.11 and system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
python3.11 \
|
|
python3.11-venv \
|
|
python3-pip \
|
|
git \
|
|
ffmpeg \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& ln -sf /usr/bin/python3.11 /usr/bin/python3 \
|
|
&& ln -sf /usr/bin/python3 /usr/bin/python
|
|
|
|
# Upgrade pip
|
|
RUN python3 -m pip install --upgrade pip
|
|
|
|
# Install CPU dependencies first
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Install GPU-specific dependencies (CuPy for CUDA 12.x)
|
|
RUN pip install --no-cache-dir cupy-cuda12x
|
|
|
|
# Build decord from source with CUDA support for GPU-native video decoding
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
cmake build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN git clone --recursive https://github.com/dmlc/decord /tmp/decord && \
|
|
cd /tmp/decord && \
|
|
mkdir build && cd build && \
|
|
cmake .. -DUSE_CUDA=ON -DCMAKE_BUILD_TYPE=Release && \
|
|
make -j$(nproc) && \
|
|
cd ../python && pip install . && \
|
|
rm -rf /tmp/decord
|
|
|
|
# Copy application
|
|
COPY . .
|
|
|
|
# Clone effects repo
|
|
RUN git clone https://git.rose-ash.com/art-dag/effects.git /app/artdag-effects
|
|
|
|
# Create cache directory
|
|
RUN mkdir -p /data/cache
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV EFFECTS_PATH=/app/artdag-effects
|
|
ENV PYTHONPATH=/app
|
|
# GPU persistence enabled - frames stay on GPU throughout pipeline
|
|
ENV STREAMING_GPU_PERSIST=1
|
|
# Use cluster's public IPFS gateway for HLS segment URLs
|
|
ENV IPFS_GATEWAY_URL=https://celery-artdag.rose-ash.com/ipfs
|
|
|
|
# Default command runs celery worker
|
|
CMD ["celery", "-A", "celery_app", "worker", "--loglevel=info", "-E", "-Q", "gpu,celery"]
|