# Use Python 3.9 FROM python:3.9 # Set working directory WORKDIR /app # Copy requirements first to leverage Docker cache COPY requirements.txt . # Install dependencies # Added --no-cache-dir to keep image small RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Create a writable directory for the model download # Hugging Face Spaces runs as a non-root user (user 1000) RUN mkdir -p /app/model_cache && chmod 777 /app/model_cache # Start the application # Note: HF Spaces expects the app to run on port 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]