Spaces:
Paused
Paused
# Use lightweight Python base | |
FROM python:3.11-slim | |
# Set environment variables | |
ENV PYTHONUNBUFFERED=1 \ | |
PIP_NO_CACHE_DIR=1 \ | |
HF_HOME=/tmp/huggingface \ | |
TRANSFORMERS_CACHE=/tmp/huggingface \ | |
HF_HUB_CACHE=/tmp/huggingface | |
# Install system deps | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
git \ | |
curl \ | |
cmake \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create working directory | |
WORKDIR /app | |
# Copy requirements (create a requirements.txt alongside app.py) | |
COPY requirements.txt . | |
# Install Python deps | |
RUN pip install --upgrade pip \ | |
&& pip install -r requirements.txt | |
# Copy the source code | |
COPY . . | |
# Expose HF Spaces port | |
EXPOSE 7860 | |
# Run FastAPI server | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |