#!/usr/bin/env bash
# docker-prep.sh — Build all packages before Docker builds.
# Docker builds use the monorepo root as context and need compiled packages.
#
# Usage:
#   ./scripts/docker-prep.sh          # build all packages
#   ./scripts/docker-prep.sh --check  # verify builds are fresh
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_ROOT"

echo "🔨 Building all packages for Docker..."
pnpm -r --filter './packages/*' build

echo ""
echo "✅ All packages built. Ready for docker compose build."
echo ""
echo "Verify with:"
echo "  docker compose build"
echo "  docker compose up -d"
echo "  docker compose ps"
