#!/usr/bin/env bash
# Real demos for P140 "How to Fix Golang 'go.mod File Not Found' Errors". Made on the Mac (Docker Desktop).
# Sue keeps the departure board for a commuter rail station in a small Go program, ~/departures. One container from
# a stock Ubuntu 24.04 image (lab/Dockerfile) with Go copied in from the official golang image and Ubuntu's docker
# command, which builds on the Mac's Docker engine through its socket. Sue and Rich each have a login; every command
# shown is typed into a real interactive bash in a pty (demo_driver.py) and every line of output is real. Files Sue
# saves in her editor wait in lab/steps/<name>/ and are copied in off camera.
set -euo pipefail
cd "$(dirname "$0")"
cleanup() { docker rm -f ce-p140-laptop >/dev/null 2>&1 || true; docker rmi board >/dev/null 2>&1 || true; }
cleanup
[ -n "${KEEP:-}" ] || trap cleanup EXIT
docker build -q -t ce-p140 lab >/dev/null
docker run -d --name ce-p140-laptop --hostname laptop -v /var/run/docker.sock:/var/run/docker.sock ce-p140 >/dev/null
python3 demo_driver.py
