AI_Avatar_Chat / Dockerfile
Developer
ULTIMATE NUCLEAR REBUILD: Complete file structure change
5a067fd
# ULTIMATE CACHE BUST: 2025-08-08_03-30-44-ULTIMATE-REBUILD - COMPLETE FILE RESTRUCTURE
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies needed for video generation
RUN apt-get update && apt-get install -y \
git \
git-lfs \
ffmpeg \
libsndfile1 \
build-essential \
curl \
&& rm -rf /var/lib/apt/lists/*
# Initialize git-lfs for large file support
RUN git lfs install
# Upgrade pip and install build tools first
RUN pip install --upgrade pip setuptools wheel
# Create necessary directories with proper permissions for HF Spaces
RUN mkdir -p /tmp/gradio_flagged \
/tmp/matplotlib \
/tmp/huggingface \
/tmp/huggingface/transformers \
/tmp/huggingface/datasets \
/tmp/huggingface/hub \
/app/outputs \
/app/pretrained_models \
/app/configs \
/app/scripts \
/app/examples \
&& chmod -R 777 /tmp \
&& chmod -R 777 /app/outputs \
&& chmod -R 777 /app/pretrained_models
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies with increased timeout for video packages
RUN pip install --no-cache-dir --timeout=1000 --retries=3 -r requirements.txt
# Copy application code
COPY . .
# Set environment variables optimized for video generation
ENV PYTHONPATH=/app
ENV PYTHONUNBUFFERED=1
ENV MPLCONFIGDIR=/tmp/matplotlib
ENV GRADIO_ALLOW_FLAGGING=never
ENV HF_HOME=/tmp/huggingface
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
ENV HUGGINGFACE_HUB_CACHE=/tmp/huggingface/hub
# Optimize for video generation
ENV TORCH_HOME=/tmp/torch
ENV CUDA_VISIBLE_DEVICES=0
# Create gradio temp directory
RUN mkdir -p /tmp/gradio && chmod -R 777 /tmp/gradio
ENV GRADIO_TEMP_DIR=/tmp/gradio
# Expose port (HuggingFace Spaces uses 7860)
EXPOSE 7860
# Health check optimized for video generation app
HEALTHCHECK --interval=30s --timeout=30s --start-period=120s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# ULTIMATE CHANGE: Run the completely renamed application
CMD ["python", "avatar_app.py"]