#!/usr/bin/env bash
# Real demos for P081 "Django vs FastAPI: Which One Should You Use?". Runs on render01 (Docker).
# One container, ce-p081-laptop: a stock Ubuntu 24.04 with Python 3.12 from apt and a virtual environment holding
# Django, Gunicorn, FastAPI and Uvicorn (lab/Dockerfile). Ana builds the same tea shop API both ways.
# Every command shown is typed into a real interactive bash in a pty (demo_driver.py), three windows on one laptop.
set -euo pipefail
cd "$(dirname "$0")"
P=ce-p081
cleanup() { docker rm -f $P-laptop >/dev/null 2>&1 || true; }
cleanup
[ -n "${KEEP:-}" ] || trap cleanup EXIT
docker build -q -t $P-laptop lab >/dev/null
docker run -d --name $P-laptop --hostname laptop $P-laptop >/dev/null
python3 - "$P" < demo_driver.py
