File size: 5,306 Bytes
fb56537
802ea4a
 
 
fb56537
 
802ea4a
fb56537
 
 
802ea4a
fb56537
802ea4a
 
 
bd316c1
fb56537
802ea4a
 
 
 
fb56537
 
802ea4a
fb56537
 
 
 
802ea4a
fb56537
 
 
802ea4a
fb56537
802ea4a
fb56537
802ea4a
fb56537
802ea4a
fb56537
802ea4a
fb56537
802ea4a
fb56537
 
802ea4a
fb56537
802ea4a
 
 
 
 
fb56537
 
 
802ea4a
fb56537
 
802ea4a
fb56537
 
802ea4a
691e419
bd316c1
 
 
92d6a21
 
 
 
 
 
 
 
 
 
 
 
 
802ea4a
 
 
bd316c1
 
691e419
bd316c1
ed2855b
 
fb56537
802ea4a
 
 
 
 
fb56537
802ea4a
691e419
fb56537
 
802ea4a
fb56537
802ea4a
fb56537
802ea4a
 
fb56537
 
 
802ea4a
fb56537
802ea4a
 
 
 
fb56537
 
802ea4a
fb56537
 
 
802ea4a
fb56537
802ea4a
fb56537
 
 
 
802ea4a
fb56537
802ea4a
fb56537
802ea4a
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# =============================================================================
# DOCKERFILE - ADUC-SDR: AI Video Suite v4.1.0
# Base: CUDA 12.8.0 | PyTorch 2.8.0+cu121
# 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+cu128"
LABEL python_version="3.10"
# A wheel do PyTorch é compilada contra o CUDA Toolkit 12.1, mas é 100% compatível
# com o driver mais recente (12.8) presente na imagem base.
LABEL pytorch_version="2.8.0+cu121"
LABEL gpu_optimized_for="8x_NVIDIA_L40S"

# =============================================================================
# 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 \
    numpy
    
    
    
# 2. Instala a wheel pré-compilada do Flash Attention 2.8.0
#    Esta é a forma mais rápida e estável de instalar, evitando compilação demorada.
#    Esta wheel é compatível com PyTorch 2.8.0 e CUDA 12.x
RUN git clone https://github.com/Dao-AILab/flash-attention && \
cd flash-attention/hopper && \
pip -v setup.py install && \
export PYTHONPATH=$PWD && \
pytest -q -s test_flash_attn.py 


# 3. Compila e instala o NVIDIA Apex
RUN git clone https://github.com/NVIDIA/apex.git && \
    cd apex && \
    pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./ && \
    cd .. && rm -rf apex

# 4. Instala os Kernels customizados do LTX
RUN pip -v install --no-build-isolation git+https://github.com/Lightricks/LTX-Video-Q8-Kernels.git

# =============================================================================
# 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

# =============================================================================
# CLONAGEM E INSTALAÇÃO DOS REPOSITÓRIOS DA APLICAÇÃO
# =============================================================================
RUN git clone https://github.com/Lightricks/LTX-Video.git && cd LTX-Video && pip install -e .[inference]
RUN git clone https://github.com/Wan-Video/Wan2.2.git && cd Wan2.2 && pip install -r requirements.txt && pip install -r requirements_s2v.txt
RUN git clone https://github.com/bytedance-seed/SeedVR.git && cd SeedVR && pip install -r requirements.txt
RUN git clone https://github.com/hkchengrex/MMAudio.git && cd MMAudio && pip install -e .

# =============================================================================
# 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/deformes_workspace && chown -R appuser:appuser /app/deformes_workspace

USER appuser

# =============================================================================
# PONTO DE ENTRADA
# =============================================================================
RUN chmod +x start.sh

ENTRYPOINT ["./start.sh"]
CMD ["gradio"]