# Build with the game logic as additional build context, e.g.
#   docker build --build-context game_logic=../wizard_server/game_logic .
# (docker compose does this automatically, see compose.yaml)
FROM python:3.13-slim

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

WORKDIR /srv

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

# Shared rules engine from the game server.
COPY --from=game_logic . /tmp/game_logic
RUN pip install /tmp/game_logic && rm -rf /tmp/game_logic

COPY wizard_ai ./wizard_ai
COPY models ./models

RUN useradd --system --no-create-home wizard
USER wizard

ENV MODEL_PATH=/srv/models/latest
CMD ["python", "-m", "wizard_ai", "serve"]
