#!/usr/bin/env bash
# Real demos for P097 "Every Django Concept a Beginner Needs to Know". Made on the Mac (Docker Desktop).
# Ben builds the job board for his small renovation company, ~/renovate. One container from a stock Ubuntu 24.04 image
# (lab/Dockerfile); Django installed from PyPI with pip in a virtual environment during the run; two real interactive
# bash windows in ptys (Ben's shell and the development server's log, demo_driver.py); the files Ben writes in his
# editor wait in lab/steps/<version>/ and are copied in off camera; real browser captures through Playwright.
set -euo pipefail
cd "$(dirname "$0")"
cleanup() { docker rm -f ce-p097-laptop >/dev/null 2>&1 || true; }
cleanup
[ -n "${KEEP:-}" ] || trap cleanup EXIT
docker build -q -t ce-p097 lab >/dev/null
docker run -d --name ce-p097-laptop --hostname laptop -p 127.0.0.1:18097:8001 ce-p097 >/dev/null
python3 demo_driver.py
