FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1

WORKDIR /app

RUN groupadd --system --gid 1000 bot \
    && useradd --system --uid 1000 --gid bot --home-dir /app --shell /usr/sbin/nologin bot

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY bot ./bot

RUN chown -R bot:bot /app

USER bot

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