Files
warehouse13/build-for-airgap.sh
2025-10-16 13:49:12 -05:00

71 lines
1.8 KiB
Bash

#!/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 24+ 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: Copying to static directory..."
if [ -d "dist/frontend/browser" ]; then
echo "✓ Build successful!"
echo "✓ Output: frontend/dist/frontend/browser"
# Copy to static directory for local FastAPI serving
cd ..
rm -rf static/*
cp -r frontend/dist/frontend/browser/* static/
echo "✓ Copied to static/ directory"
ls -lh static/ | head -10
else
echo "✗ Build failed - output directory not found"
exit 1
fi
echo ""
echo "========================================="
echo "Build Complete!"
echo "========================================="
echo ""
echo "The Angular app has been built and copied to static/"
echo "You can now:"
echo ""
echo "1. Run locally with FastAPI:"
echo " uvicorn app.main:app --reload"
echo " Access at: http://localhost:8000"
echo ""
echo "2. Deploy with Docker:"
echo " docker-compose up -d --build"
echo " (Docker will rebuild Angular during build)"
echo ""
echo "========================================="