FROM python:3.11-slim WORKDIR /code # Install system dependencies RUN apt-get update && apt-get install -y \ wget \ curl \ && rm -rf /var/lib/apt/lists/* # Create cache directories with proper permissions RUN mkdir -p /code/cache && \ mkdir -p /tmp/cache && \ chmod 777 /code/cache && \ chmod 777 /tmp/cache # Set environment variables for cache directories ENV TRANSFORMERS_CACHE=/code/cache ENV HF_HOME=/code/cache ENV TORCH_HOME=/code/cache # Copy requirements and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application code COPY . . # Expose port 7860 (Hugging Face Spaces default) EXPOSE 7860 # Run the application CMD ["python", "app.py"]