# Python 3.13+ is required: ssl.SSLContext.set_psk_client_callback (TLS-PSK)
# is only available from 3.13.
FROM python:3.13-slim

WORKDIR /app

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

COPY . .

RUN mkdir -p /var/log/mqtt-client \
    && useradd --system --no-create-home mqtt \
    && chown -R mqtt:mqtt /var/log/mqtt-client
USER mqtt

CMD ["python", "-u", "main.py"]
