Simulates a fresh git clone + docker build of the dashboard image,
WITHOUT requiring docker. Reproduces the exact failure mode that bit us
in PR #1/#2/#3 (file present locally but missing from git, so build
worked in dev but failed on prod after `git pull`).
What it does:
1. Lists git-tracked files in `dashboard/`
2. Creates a temp build context containing ONLY those files (simulates
what `docker build` actually sees on a fresh clone)
3. Applies `.dockerignore` patterns
4. Parses `Dockerfile` COPY commands and verifies each source exists
in the build context (fails fast if anything is missing)
5. Runs `npm ci --no-audit --no-fund`
6. Runs `npm run build`
7. Verifies `.next/standalone/server.js` and `.next/static/` exist
Usage:
bash dashboard/validate-build.sh # from repo root
bash validate-build.sh # from dashboard/
bash /path/to/validate-build.sh /path/to/repo
Catches: missing files in COPY, missing public/, missing next-env.d.ts
(though the Dockerfile now creates that one on the fly), and any
TypeScript/Next.js build errors.
Run this BEFORE pushing any dashboard change.