|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FROM nvidia/cuda:12.8.0-devel-ubuntu22.04 |
|
|
|
|
|
LABEL maintainer="Carlos Rodrigues dos Santos" |
|
|
LABEL description="ADUC-SDR: High-performance Diffusers stack for 8x NVIDIA L40S with LTX-Video and SeedVR" |
|
|
LABEL version="5.0.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" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive TZ=UTC LANG=C.UTF-8 LC_ALL=C.UTF-8 \ |
|
|
PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 \ |
|
|
PIP_NO_CACHE_DIR=0 PIP_DISABLE_PIP_VERSION_CHECK=1 |
|
|
|
|
|
|
|
|
ENV NVIDIA_VISIBLE_DEVICES=all \ |
|
|
TORCH_CUDA_ARCH_LIST="8.9" \ |
|
|
CUDA_DEVICE_ORDER=PCI_BUS_ID \ |
|
|
CUDA_DEVICE_MAX_CONNECTIONS=32 |
|
|
|
|
|
|
|
|
ENV OMP_NUM_THREADS=8 MKL_NUM_THREADS=8 MAX_JOBS=160 |
|
|
|
|
|
|
|
|
ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512,garbage_collection_threshold:0.8 \ |
|
|
CUDA_LAUNCH_BLOCKING=0 CUDA_CACHE_MAXSIZE=2147483648 CUDA_CACHE_DISABLE=0 |
|
|
|
|
|
|
|
|
ENV APP_HOME=/app \ |
|
|
HF_HOME=/data/.cache/huggingface \ |
|
|
TORCH_HOME=/data/.cache/torch \ |
|
|
HF_DATASETS_CACHE=/data/.cache/datasets \ |
|
|
TRANSFORMERS_CACHE=/data/.cache/transformers \ |
|
|
DIFFUSERS_CACHE=/data/.cache/diffusers \ |
|
|
HF_HUB_ENABLE_HF_TRANSFER=1 \ |
|
|
TOKENIZERS_PARALLELISM=false |
|
|
|
|
|
WORKDIR $APP_HOME |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN useradd -m -u 1000 -s /bin/bash appuser && \ |
|
|
mkdir -p /data $APP_HOME /app/output |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \ |
|
|
build-essential gosu tree cmake git git-lfs curl wget ffmpeg ninja-build \ |
|
|
python3.10 python3.10-dev python3.10-distutils python3-pip \ |
|
|
ca-certificates libglib2.0-0 libgl1 \ |
|
|
&& apt-get clean && rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN ln -sf /usr/bin/python3.10 /usr/bin/python && \ |
|
|
python3 -m pip install --upgrade pip |
|
|
|
|
|
# ============================================================================= |
|
|
# 3. Instalação da Toolchain de Machine Learning (Mantida 100% Original) |
|
|
# ============================================================================= |
|
|
|
|
|
# --- PyTorch para CUDA 12.8 --- |
|
|
RUN pip install --index-url https://download.pytorch.org/whl/cu128 \ |
|
|
torch>=2.8.0+cu128 torchvision>=0.23.0+cu128 torchaudio>=2.8.0+cu128 |
|
|
|
|
|
# --- Ferramentas de Compilação, Triton e FlashAttention --- |
|
|
RUN pip install packaging ninja cmake pybind11 scikit-build cython hf_transfer "numpy>=1.24.4" |
|
|
|
|
|
# --- Triton 3.x --- |
|
|
RUN pip uninstall -y triton || true && \ |
|
|
pip install -v --no-build-isolation triton==3.4.0 |
|
|
|
|
|
# --- FlashAttention 2.8.x --- |
|
|
#RUN pip install flash-attn==2.8.3 --no-build-isolation || \ |
|
|
# pip install flash-attn==2.8.2 --no-build-isolation || \ |
|
|
# pip install flash-attn==2.8.1 --no-build-isolation || \ |
|
|
# pip install flash-attn==2.8.0.post2 --no-build-isolation |
|
|
|
|
|
# ============================================================================= |
|
|
# 4. Instalação das Dependências da Aplicação |
|
|
# ============================================================================= |
|
|
# Copia e instala requirements.txt primeiro para otimizar o cache de camadas do Docker. |
|
|
COPY --chown=appuser:appuser requirements.txt ./requirements.txt |
|
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
# --- Instalação de bitsandbytes e Wheels Customizados (Mantido 100% Original) --- |
|
|
RUN pip install --upgrade bitsandbytes |
|
|
|
|
|
# Instala wheels customizados (Apex, etc.) |
|
|
# Instala q8_kernels |
|
|
RUN pip install --no-cache-dir \ |
|
|
"https://huggingface.co/euIaxs22/Aduc-sdr/resolve/main/q8_kernels-0.0.5-cp310-cp310-linux_x86_64.whl" |
|
|
|
|
|
RUN echo "Installing custom wheels..." && \ |
|
|
pip install --no-cache-dir \ |
|
|
"https://huggingface.co/euIaxs22/Aduc-sdr/resolve/main/apex-0.1-cp310-cp310-linux_x86_64.whl" \ |
|
|
"https://huggingface.co/euIaxs22/Aduc-sdr/resolve/main/dropout_layer_norm-0.1-cp310-cp310-linux_x86_64.whl" |
|
|
|
|
|
# ============================================================================= |
|
|
# 5. Cópia do Código-Fonte e Configuração Final |
|
|
# ============================================================================= |
|
|
# Copia o restante do código-fonte da aplicação por último. |
|
|
COPY --chown=appuser:appuser . . |
|
|
|
|
|
# Garante que todos os scripts de inicialização sejam executáveis |
|
|
# e que o usuário 'appuser' seja o dono de todos os arquivos. |
|
|
RUN chown -R appuser:appuser $APP_HOME /data && \ |
|
|
chmod +x /app/entrypoint.sh /app/start.sh /app/info.sh /app/builder.sh |
|
|
|
|
|
# ============================================================================= |
|
|
# 6. Ponto de Entrada |
|
|
# ============================================================================= |
|
|
# Expõe o diretório /data para ser montado como um volume persistente. |
|
|
VOLUME /data |
|
|
|
|
|
# Define o usuário padrão para a execução do contêiner. |
|
|
USER appuser |
|
|
|
|
|
# Define o script que será executado na inicialização do contêiner. |
|
|
ENTRYPOINT ["/app/entrypoint.sh"] |
|
|
|
|
|
# Define o comando padrão a ser executado pelo entrypoint. |
|
|
CMD ["/app/start.sh"] |