# 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

# Build context is the repo root (see docker-compose.yml).
COPY mqtt-client/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY mqtt-client/ /app/

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"]
