# syntax=docker/dockerfile:1
FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

WORKDIR /app

# Copy into /app/listener/ (not /app/): `COPY listener/ /app/` would flatten the
# directory contents into /app and `python -m listener.main` would find no package.
COPY listener/requirements.txt /app/listener/requirements.txt
RUN pip install --no-cache-dir -r /app/listener/requirements.txt

COPY listener/ /app/listener/

# Run as an unprivileged user.
RUN useradd --system --create-home --uid 10001 appuser
USER appuser

CMD ["python", "-m", "listener.main"]