FROM python:3.9-slim

WORKDIR /app

# Without this, stdout is block-buffered when not a TTY, so `docker logs` lags far
# behind reality — during the June outage the "MQTT Connection failed" line did not
# surface until long after the failure.
ENV PYTHONUNBUFFERED=1

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
