# Use a slim Python image | |
FROM python:3.10-slim | |
ENV HF_HOME=/home/user/.cache/huggingface | |
RUN mkdir -p /home/user/.cache/huggingface && \ | |
chmod 777 /home/user/.cache/huggingface | |
# Install system deps | |
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* | |
WORKDIR /app | |
# Copy & install Python deps | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy your API code | |
COPY app.py . | |
# Expose port and launch with uvicorn | |
EXPOSE 7860 | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |