Spaces:
Sleeping
Sleeping
| # Use a slim version of Python to reduce base image size | |
| FROM python:3.13 | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| # Set work directory | |
| WORKDIR /app | |
| # Install system dependencies if needed (e.g., libmagic for unstructured) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libmagic1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy only requirements first to leverage Docker cache | |
| COPY requirements.txt . | |
| # Install dependencies and clean up cache in one layer | |
| # TIP: If deploying to CPU-only environments, consider installing CPU versions of torch | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application code | |
| COPY . . | |
| # Run the application | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |