| # Use official Python slim image | |
| FROM python:3.11-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install OS dependencies for image processing and ML | |
| RUN apt-get update && apt-get install -y \ | |
| libglib2.0-0 libsm6 libxext6 libxrender-dev libgomp1 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements and install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy app source code and models | |
| COPY ./app ./app | |
| COPY ./models ./models | |
| # Expose port 8000 for FastAPI | |
| EXPOSE 7860 | |
| # Command to run the FastAPI server using uvicorn | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |