# Stage 1: Build stage (installs docker) FROM python:3.10.12 AS builder RUN apt-get update && apt-get install -y \ docker-ce \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Clear build cache RUN docker builder prune -f # Stage 2: Final stage FROM python:3.10.12 USER root RUN apt-get update && \ apt-get install -y \ libgl1-mesa-glx \ ffmpeg \ git \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ NUMBA_CACHE_DIR=/tmp/numba_cache WORKDIR $HOME/app COPY --chown=user . $HOME/app # Clone pretrained models and check if folder is created RUN git lfs install && \ git clone https://huggingface.co/fudan-generative-ai/hallo pretrained_models && \ echo "Listing pretrained_models folder content:" && \ ls -la pretrained_models && \ echo "Listing pretrained_models/face_analysis/models folder content:" && \ ls -la pretrained_models/face_analysis/models # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt RUN ls -la # Install the current package with verbose output RUN pip install . --verbose # Set the command to run the application CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "300", "app_hallo:app"]