| # 1. Use lightweight Python | |
| FROM python:3.10-slim | |
| # 2. INSTALL SYSTEM DEPENDENCIES FIRST | |
| RUN apt-get update && apt-get install -y \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 3. Set working directory | |
| WORKDIR /code | |
| # 4. Copy requirements and install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 5. Copy your application code | |
| COPY app /code/app | |
| # 6. Set environment variables | |
| ENV PYTHONPATH=/code | |
| # 7. Expose the port | |
| EXPOSE 7860 | |
| # 8. Start the app | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |