# ============================================================================= # DOCKERFILE - ADUC-SDR: AI Video Suite v4.1.0 # Base: CUDA 12.8.0 | PyTorch 2.8.0+cu128 # Otimizado para Hugging Face Spaces com 8x NVIDIA L40S GPUs # ============================================================================= # Base CUDA 12.8.0 FROM nvidia/cuda:12.8.0-devel-ubuntu22.04 # ============================================================================= # METADADOS # ============================================================================= LABEL maintainer="Carlos Rodrigues dos Santos & Development Partner" LABEL description="ADUC-SDR: Production-Ready Multi-GPU AI Video Generation Suite with Wan2.2, SeedVR, LTX, MMAudio" LABEL version="4.1.0" LABEL cuda_version="12.8.0" LABEL python_version="3.10" LABEL pytorch_version="2.8.0+cu128" LABEL gpu_optimized_for="8x_NVIDIA_L40S" # Otimizações específicas do sistema ENV OMP_NUM_THREADS=8 ENV MKL_NUM_THREADS=8 ENV CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 ENV CUDA_DEVICE_MAX_CONNECTIONS=32 # Cache e Memory Management # Unificar PYTORCH_CUDA_ALLOC_CONF em uma linha ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512,garbage_collection_threshold:0.8 ENV CUDA_MODULE_LOADING=LAZY ENV CUDA_DEVICE_MAX_CONNECTIONS=32 ENV CUDA_DEVICE_ORDER=PCI_BUS_ID # Constantes de Performance para Build ENV CUDA_CACHE_MAXSIZE=2147483648 ENV CUDA_CACHE_DISABLE=0 ENV TORCH_HOME=/app/.cache/torch ENV HF_HOME=/app/.cache/huggingface ENV HF_DATASETS_CACHE=/app/.cache/datasets # Constantes de Memory Management ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512,garbage_collection_threshold:0.8 ENV CUDA_LAUNCH_BLOCKING=0 ENV CUDA_DEVICE_ORDER=PCI_BUS_ID # Constantes de Model Loading ENV TRANSFORMERS_CACHE=/app/.cache/transformers ENV DIFFUSERS_CACHE=/app/.cache/diffusers ENV MODEL_CACHE_STRATEGY=aggressive # Melhorias de cache/download ENV HF_HOME=/app/.cache/huggingface ENV TRANSFORMERS_CACHE=/app/.cache/transformers ENV DIFFUSERS_CACHE=/app/.cache/diffusers ENV HF_DATASETS_CACHE=/app/.cache/datasets ENV HF_HUB_ENABLE_HF_TRANSFER=1 ENV TOKENIZERS_PARALLELISM=false # ============================================================================= # VARIÁVEIS DE AMBIENTE GLOBAIS # ============================================================================= ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC ENV LANG=C.UTF-8 ENV LC_ALL=C.UTF-8 ENV PYTHONUNBUFFERED=1 ENV PYTHONDONTWRITEBYTECODE=1 ENV PIP_NO_CACHE_DIR=1 ENV PIP_DISABLE_PIP_VERSION_CHECK=1 # Otimizações de CUDA e Build ENV NVIDIA_VISIBLE_DEVICES=all ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility ENV TORCH_CUDA_ARCH_LIST="8.9" ENV MAX_JOBS=90 # Caminhos da Aplicação ENV APP_HOME=/app WORKDIR $APP_HOME # ============================================================================= # PACOTES DO SISTEMA E PYTHON 3.10 # ============================================================================= RUN apt-get update && \ apt-get install -y --no-install-recommends \ build-essential cmake git git-lfs curl wget ffmpeg ninja-build \ python3.10 python3.10-dev python3.10-distutils python3-pip \ && apt-get clean && rm -rf /var/lib/apt/lists/* RUN ln -sf /usr/bin/python3.10 /usr/bin/python3 && \ ln -sf /usr/bin/python3.10 /usr/bin/python && \ python3 -m pip install --upgrade pip # ============================================================================= # INSTALAÇÃO DE BIBLIOTECAS DE ALTA PERFORMANCE # ============================================================================= # 1. Instala PyTorch 2.8.0 e ferramentas de build RUN pip -v install \ torch>=2.8.0+cu128 \ torchvision \ torchaudio \ --index-url https://download.pytorch.org/whl/cu128 RUN pip install \ packaging \ ninja \ cmake \ pybind11 \ scikit-build \ cython \ hf_transfer \ numpy==1.24.4 # ============================================================================= # CLONAGEM E INSTALAÇÃO DOS REPOSITÓRIOS DA APLICAÇÃO # ============================================================================= RUN git clone https://github.com/Wan-Video/Wan2.2.git && \ #cd Wan2.2 && pip install -v -r requirements.txt && pip install -v -r requirements_s2v.txt && cd .. && \ echo "Copiando 'wan' para /app/wan..." && \ cp -r Wan2.2/wan /app/wan # VINCIE RUN git clone https://github.com/bytedance-seed/VINCIE.git && \ #cd VINCIE && pip install -v -r requirements.txt && cd .. && \ #echo "Copiando módulos do SeedVR para /app/..." && \ #cp /VINCIE/generate.py /app/VINCIE/ 2>/dev/null || echo "vincie_service.py não encontrado" #cp -r VINCIE /app/VINCIE && \ #cp -r VINCIE/projects /app/projects && \ #cp -r VINCIE/data /app/data && \ cp -r VINCIE/configs/. /app/configs/ # SeedVR RUN git clone https://github.com/bytedance-seed/SeedVR.git && \ #cd SeedVR && pip install -v -r requirements.txt && cd .. && \ #echo "Copiando módulos do SeedVR para /app/..." && \ #cp -r SeedVR/common /app/common && \ #cp -r SeedVR/projects /app/projects && \ #cp -r SeedVR/data /app/data && \ cp -r SeedVR/configs_3b /app/configs_3b # MMAudio #RUN git clone https://github.com/hkchengrex/MMAudio.git && \ # cd MMAudio && pip install -v -e . && cd .. && \ # echo "Copiando 'mmaudio' para /app/mmaudio..." && \ # cp -r MMAudio/mmaudio /app/mmaudio # LTX-Video RUN git clone https://github.com/Lightricks/LTX-Video.git && \ #cd LTX-Video && pip install -v -e .[inference] && cd .. && \ echo "Copiando 'ltx_video' para /app/ltx_video..." && \ cp -r LTX-Video/ltx_video /app/ltx_video # opcionais RUN pip uninstall -y bitsandbytes triton && \ pip install -v bitsandbytes --index-url https://pypi.org/simple/ && \ pip install -v triton # ============================================================================= # INSTALAÇÃO DO RESTANTE DAS DEPENDÊNCIAS # ============================================================================= COPY requirements.txt . # Instala os pacotes restantes do requirements.txt # A linha do flash-attention no arquivo será ignorada se já estiver instalado, mas é bom limpá-la. RUN pip install -r requirements.txt # PyTorch cu128 (fixar versões consistentes do mesmo canal) RUN pip install --index-url https://download.pytorch.org/whl/cu128 \ torch==2.8.0+cu128 torchvision>=0.19.0+cu128 torchaudio>=2.8.0+cu128 # ============================================================================= # COPIA O CÓDIGO DA APLICAÇÃO E CONFIGURA PERMISSÕES # ============================================================================= COPY . . RUN useradd -m -u 1000 -s /bash appuser && \ chown -R appuser:appuser $APP_HOME && \ mkdir -p /app && chown -R appuser:appuser /app USER appuser # ============================================================================= # PONTO DE ENTRADA # ============================================================================= RUN chmod +x ./start.sh ENTRYPOINT ["./start.sh"] CMD ["gradio"]