Spaces:
Running
Running
FROM python:3.10-slim | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
git \ | |
&& rm -rf /var/lib/apt/lists/* | |
RUN mkdir -p .cache/hub | |
RUN mkdir -p .cache/modules | |
RUN chmod -R 777 .cache/hub | |
RUN chmod -R 777 .cache/modules | |
# Copy requirements first to leverage Docker cache | |
COPY requirements.txt . | |
# Install dependencies including CPU-only PyTorch | |
RUN pip install --no-cache-dir -r requirements.txt \ | |
&& pip install torch --index-url https://download.pytorch.org/whl/cpu | |
# Copy application code | |
COPY . . | |
# Expose port | |
EXPOSE 7860 | |
# Run the application | |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |