FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ python3 python3-pip \ git wget \ && rm -rf /var/lib/apt/lists/* RUN ln -sf /usr/bin/python3 /usr/bin/python # Install PyTorch with CUDA 12.1 (downgraded from 2.6.0 -- no cu121 wheels for 2.6+) RUN pip install --no-cache-dir \ torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 \ --index-url https://download.pytorch.org/whl/cu121 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN git clone https://github.com/yermandy/deepfake-detection.git model_code RUN mkdir -p model_code/weights && \ wget https://huggingface.co/yermandy/deepfake-detection/resolve/main/model.ckpt -O model_code/weights/model.ckpt ENV HF_HOME=/app/huggingface_cache ENV TRANSFORMERS_CACHE=/app/huggingface_cache ENV HF_HUB_CACHE=/app/huggingface_cache RUN mkdir -p $HF_HOME RUN pip install --no-cache-dir --upgrade transformers RUN python -c "from transformers import CLIPProcessor, CLIPModel; \ CLIPProcessor.from_pretrained('openai/clip-vit-base-patch16'); \ CLIPProcessor.from_pretrained('openai/clip-vit-base-patch32'); \ CLIPProcessor.from_pretrained('openai/clip-vit-large-patch14'); \ CLIPProcessor.from_pretrained('openai/clip-vit-large-patch14-336'); \ CLIPModel.from_pretrained('openai/clip-vit-large-patch14')" COPY app.py . ENV MODEL_PORT=5002 ENV MODEL_PATH=model_code/weights/model.ckpt ENV PRELOAD_MODEL="false" ENV MODEL_TIMEOUT="600" ENV PYTHONPATH=/app/model_code:/app/model_code/src:$PYTHONPATH EXPOSE ${MODEL_PORT} RUN adduser --disabled-password --gecos '' appuser USER appuser CMD ["python", "app.py"]