#!/bin/bash # Demonstrate the optimization concept echo "🎯 Demonstrating Docker Optimization" echo "====================================" # Create a demo directory structure DEMO_DIR="optimization-demo" rm -rf $DEMO_DIR mkdir -p $DEMO_DIR # Copy only runtime files echo -e "\n📦 Creating minimal runtime package..." cat > $DEMO_DIR/package.json << 'EOF' { "name": "n8n-mcp-optimized", "version": "1.0.0", "private": true, "main": "dist/mcp/index.js", "dependencies": { "@modelcontextprotocol/sdk": "^1.12.1", "better-sqlite3": "^11.10.0", "sql.js": "^1.13.0", "express": "^5.1.0", "dotenv": "^16.5.0" } } EOF # Copy built files echo "📁 Copying built application..." cp -r dist $DEMO_DIR/ cp -r data $DEMO_DIR/ mkdir -p $DEMO_DIR/src/database cp src/database/schema*.sql $DEMO_DIR/src/database/ # Calculate sizes echo -e "\n📊 Size comparison:" echo "Original project: $(du -sh . | cut -f1)" echo "Optimized runtime: $(du -sh $DEMO_DIR | cut -f1)" # Show what's included echo -e "\n✅ Optimized package includes:" echo "- Pre-built SQLite database with all node info" echo "- Compiled JavaScript (dist/)" echo "- Minimal runtime dependencies" echo "- No n8n packages needed!" # Create a simple test echo -e "\n🧪 Testing database content..." if command -v sqlite3 &> /dev/null; then NODE_COUNT=$(sqlite3 data/nodes.db "SELECT COUNT(*) FROM nodes;" 2>/dev/null || echo "0") AI_COUNT=$(sqlite3 data/nodes.db "SELECT COUNT(*) FROM nodes WHERE is_ai_tool = 1;" 2>/dev/null || echo "0") echo "- Total nodes in database: $NODE_COUNT" echo "- AI-capable nodes: $AI_COUNT" else echo "- SQLite CLI not installed, skipping count" fi echo -e "\n💡 This demonstrates that we can run n8n-MCP with:" echo "- ~50MB of runtime dependencies (vs 1.6GB)" echo "- Pre-built database (11MB)" echo "- No n8n packages at runtime" echo "- Total optimized size: ~200MB (vs 2.6GB)" # Cleanup echo -e "\n🧹 Cleaning up demo..." rm -rf $DEMO_DIR echo -e "\n✨ Optimization concept demonstrated!"