# Use the official Python image as base FROM python:3.10-slim # Avoid prompts during builds ARG CACHEBUST=1 ENV DEBIAN_FRONTEND=noninteractive # Set workdir WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ build-essential \ ffmpeg \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ && rm -rf /var/lib/apt/lists/* # Upgrade pip and install build tools early to avoid CLIP build issues RUN pip install --upgrade pip setuptools wheel build # Preinstall OpenAI CLIP from GitHub to avoid setup.py error RUN pip install git+https://github.com/openai/CLIP.git # Copy the rest of your dependencies COPY requirements.txt . # Install remaining Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Copy your app code (optional - assuming you have app.py or similar) COPY . . # Expose gradio on port 7860 (Hugging Face auto-detects this) EXPOSE 7860 # Start Gradio app (adjust this if your main file is different) CMD ["python", "app.py"]