# Use an official Python runtime as a parent image FROM python:3.9.13 # Install system dependencies # RUN apt-get update && \ # apt-get install -y \ # ffmpeg \ # libgl1 \ # && apt-get clean \ # && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y \ ffmpeg \ git \ curl \ wget \ libgl1 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Set up user RUN useradd -m -u 1000 user USER user # # Set environment variables # ENV HOME=/home/user \ # PATH=/home/user/.local/bin:$PATH \ # NUMBA_CACHE_DIR=/tmp/numba_cache ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ NUMBA_CACHE_DIR=/tmp/numba_cache \ NVIDIA_VISIBLE_DEVICES=all \ NVIDIA_DRIVER_CAPABILITIES=compute,utility # Set working directory WORKDIR $HOME/app # Copy project files COPY --chown=user . $HOME/app # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Install Hugging Face CLI and download model checkpoints RUN pip install huggingface_hub && \ huggingface-cli download ByteDance/LatentSync --local-dir checkpoints --exclude "*.git*" "README.md" --include "latentsync_unet.pt" "whisper/tiny.pt" # Expose port EXPOSE 7860 # Start the application with Gunicorn # CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "300", "app:app"] CMD ["gunicorn", "-w", "2", "-k", "gevent", "-b", "0.0.0.0:7860", "--timeout", "600", "app:app"]