# ---------- base image ---------- FROM python:3.11-slim # ---------- runtime options ---------- ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ LOG_LEVEL=INFO \ WORKERS=4 # ---------- install system deps ---------- RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential curl && \ rm -rf /var/lib/apt/lists/* # ---------- install Python deps ---------- WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # ---------- copy source ---------- COPY . . # ---------- network ---------- EXPOSE 8000 # ---------- healthcheck ---------- HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD \ curl -sf http://localhost:8000/health || exit 1 # ---------- start ---------- CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port 8000 --workers $WORKERS"]