FROM python:3.10-slim WORKDIR /app # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy all files COPY . . # Create instance directory with proper permissions RUN mkdir -p /app/instance && chmod 777 /app/instance # Optional: avoid using cached Hugging Face models in root directory ENV TRANSFORMERS_CACHE=/app/cache ENV HF_HOME=/app/cache # Set PYTHONPATH (useful if you're importing from app/) ENV PYTHONPATH=/app # HF Spaces default port is 7860 EXPOSE 7860 # Start server CMD ["gunicorn", "--bind", "0.0.0.0:7860", "main:app"]