FROM python:3.11-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ HF_HOME=/app/.cache/huggingface \ TRANSFORMERS_CACHE=/app/.cache/huggingface WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ libgl1 libglib2.0-0 curl \ && rm -rf /var/lib/apt/lists/* COPY server/requirements.txt . RUN pip install --upgrade pip setuptools wheel RUN pip install --no-cache-dir --no-build-isolation -r requirements.txt COPY . . RUN mkdir -p /app/.cache/huggingface # Pre-download deepfake model to avoid runtime delays RUN python -c "from transformers import pipeline; pipeline('image-classification', model='dima806/deepfake_vs_real_image_detection', device=-1)" 2>&1 || echo "Model download optional" EXPOSE 7860 CMD ["uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "7860"]