Spaces:
Running
Running
| FROM python:3.10-slim | |
| # Set environment variables for Hugging Face cache | |
| # Before running your app | |
| ENV HF_HOME=/app/hf_cache | |
| ENV TRANSFORMERS_CACHE=/app/hf_cache | |
| ENV XDG_CACHE_HOME=/app/hf_cache | |
| RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache | |
| # Create working directory | |
| WORKDIR /code | |
| # System dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| wget \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python packages | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # Copy app code | |
| COPY . . | |
| # Create model cache directory | |
| RUN mkdir -p /code/hf_cache | |
| # Expose FastAPI port | |
| EXPOSE 7860 | |
| # Start the app | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |