FROM python:3.10-slim | |
ENV HF_HOME=/tmp/huggingface | |
ENV TORCH_HOME=/tmp/torch | |
# System dependencies for OpenCV | |
RUN apt-get update && apt-get install -y \ | |
libgl1 \ | |
libglib2.0-0 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set working directory | |
WORKDIR /app | |
# Copy everything | |
COPY . . | |
# Install Python dependencies | |
RUN pip install --no-cache-dir --upgrade pip | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Expose port | |
EXPOSE 7860 | |
# Start FastAPI app | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |