#!/bin/bash set -e echo "=========================================" echo "Building Angular for Air-Gapped Deployment" echo "=========================================" echo "" # Check if we're in the right directory if [ ! -f "docker-compose.yml" ]; then echo "Error: Must run from project root directory" exit 1 fi # Check if node is installed if ! command -v node &> /dev/null; then echo "Error: Node.js is not installed. Please install Node.js 18+ first." exit 1 fi # Check if npm is installed if ! command -v npm &> /dev/null; then echo "Error: npm is not installed. Please install npm first." exit 1 fi echo "Step 1/3: Installing dependencies..." cd frontend npm install echo "" echo "Step 2/3: Building Angular production bundle..." npm run build:prod echo "" echo "Step 3/3: Verifying build output..." if [ -d "dist/frontend/browser" ]; then echo "✓ Build successful!" echo "✓ Output: frontend/dist/frontend/browser" ls -lh dist/frontend/browser | head -5 else echo "✗ Build failed - output directory not found" exit 1 fi cd .. echo "" echo "=========================================" echo "Build Complete!" echo "=========================================" echo "" echo "Next steps:" echo "1. Update docker-compose.yml:" echo " Change: dockerfile: Dockerfile.frontend" echo " To: dockerfile: Dockerfile.frontend.prebuilt" echo "" echo "2. Deploy:" echo " docker-compose up -d --build" echo "" echo "See DEPLOYMENT.md for more details." echo "========================================="