diff --git a/build-for-airgap.sh b/build-for-airgap.sh new file mode 100644 index 0000000..6279808 --- /dev/null +++ b/build-for-airgap.sh @@ -0,0 +1,70 @@ +#!/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 "=========================================" diff --git a/quickstart-airgap.sh b/quickstart-airgap.sh index 4c6c03f..0f6097f 100755 --- a/quickstart-airgap.sh +++ b/quickstart-airgap.sh @@ -28,12 +28,17 @@ if ! command -v docker-compose &> /dev/null; then exit 1 fi -echo "Step 1: Starting Docker containers..." +echo "Step 1: Building Angular frontend locally..." +echo "===========================================" +./build-for-airgap.sh + +echo "" +echo "Step 2: Starting Docker containers..." echo "===========================================" docker-compose up -d --build echo "" -echo "Step 2: Waiting for services to be ready..." +echo "Step 3: Waiting for services to be ready..." sleep 15 echo ""