FROM python:3.12-slim

RUN apt-get update && apt-get install -qyy --no-install-recommends \
    xvfb \
    ffmpeg \
    x11-xserver-utils \
    xterm \
    xfonts-base \
    fonts-jetbrains-mono \
    fonts-dejavu-core \
    && rm -rf /var/lib/apt/lists/*

ENV PYTHONUNBUFFERED=1
ENV TERM=xterm-256color

WORKDIR /app

# Thea recorder (>= 0.18: Terminal submodule, step tracker, keyboard APIs)
RUN pip install --no-cache-dir 'thea-recorder>=0.18.0'

# dm CLI dependencies
RUN pip install --no-cache-dir rich pyyaml qrcode

# xterm config for readable, styled terminal
COPY demos/Xresources /root/.Xresources

# dm CLI (the tool being demoed)
COPY scripts/dm /usr/local/bin/dm
RUN chmod +x /usr/local/bin/dm

# Shared mock API from tests/support/
COPY tests/ tests/

# Demo scripts
COPY demos/demos/ demos/
COPY demos/record_all.py .

ENTRYPOINT ["python", "record_all.py"]
