# Use a lightweight Python image | |
FROM python:3.10-slim | |
# Install necessary system dependencies | |
RUN apt-get update && apt-get install -y \ | |
libgl1-mesa-glx \ | |
libglib2.0-0 \ | |
&& rm -rf /var/lib/apt/lists/* # Clean up package lists to reduce image size | |
# Set the working directory inside the container | |
WORKDIR /app | |
# Copy and install dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the entire project | |
COPY . . | |
# Expose the correct port for Hugging Face Spaces | |
EXPOSE 7860 | |
# Run FastAPI using Uvicorn | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |