| # 1) Base image | |
| FROM python:3.10-slim | |
| # 2) Print logs unbuffered | |
| ENV PYTHONUNBUFFERED=1 | |
| # 3) Working directory | |
| WORKDIR /app | |
| # 4) Copy & install Python dependencies | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 5) Copy your FastAPI app | |
| COPY classifier.py . | |
| # 6) Build-time secret (or omit and inject at runtime) | |
| ARG TOGETHERAI_API_KEY | |
| ENV TOGETHERAI_API_KEY=${TOGETHERAI_API_KEY} | |
| # 7) Expose the port | |
| EXPOSE 8000 | |
| # 8) Launch Uvicorn directly—no wrapper script needed | |
| CMD ["uvicorn", "classifier:app", "--host", "0.0.0.0", "--port", "8000", "--log-level", "info"] | |