FROM python:3.11-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ POETRY_VIRTUALENVS_CREATE=false WORKDIR /app # Install system deps (add build deps only if needed for some packages) RUN apt-get update \ && apt-get install -y --no-install-recommends build-essential gcc git ca-certificates \ && rm -rf /var/lib/apt/lists/* # Copy only the source tree (we expect requirements.txt at repo root) COPY services/ai-service/src /app COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir -r /app/requirements.txt uvicorn[standard] EXPOSE 7860 ENV PRELOAD_SMALL_MODELS=false # Use uvicorn directly for FastAPI (ASGI) instead of gunicorn (WSGI) CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "1200", "--workers", "4"]