admin / AirportCyberSimulator
publicAirport Cyber Attack Simulation Application
AirportCyberSimulator / airport-cyber-sim-v2-exe / build_exe.ps1
1943 B · main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | <# .SYNOPSIS Builds a fully self-contained, offline Windows executable of the Airport Cyber Resilience Simulator using PyInstaller. .DESCRIPTION Bundles the Python runtime, all dependencies (FastAPI, uvicorn, websockets), the static frontend, vendored JS libraries, vendored fonts and the JSON data into a single AirportCyberSim.exe under .\dist. No Python, Docker or internet is required to RUN the result. Requires (build time only): Python 3.11+, pip, and PyInstaller (pip install pyinstaller). .EXAMPLE .\build_exe.ps1 #> [CmdletBinding()] param( [switch]$OneDir # build a folder instead of a single .exe (faster startup) ) $ErrorActionPreference = 'Stop' Set-Location -Path $PSScriptRoot if (-not (Get-Command python -ErrorAction SilentlyContinue)) { Write-Host "Python not found on PATH." -ForegroundColor Red; exit 1 } try { python -c "import PyInstaller" 2>$null } catch {} if (-not $?) { Write-Host "PyInstaller not installed. Installing it now..." -ForegroundColor Yellow python -m pip install pyinstaller } $mode = if ($OneDir) { '--onedir' } else { '--onefile' } $src = Join-Path $PSScriptRoot 'src' Write-Host "Building AirportCyberSim.exe ($mode)..." -ForegroundColor Cyan python -m PyInstaller ` --noconfirm --clean $mode ` --name AirportCyberSim ` --distpath dist --workpath build --specpath build ` --paths "$src" ` --add-data "$src\static;static" ` --add-data "$src\data;data" ` --collect-all uvicorn ` --collect-all websockets ` --collect-submodules anyio ` "$src\run.py" if ($LASTEXITCODE -eq 0) { Write-Host "" Write-Host "Build complete." -ForegroundColor Green if ($OneDir) { Write-Host "Run: .\dist\AirportCyberSim\AirportCyberSim.exe" } else { Write-Host "Run: .\dist\AirportCyberSim.exe" } } else { Write-Host "Build failed (exit $LASTEXITCODE)." -ForegroundColor Red exit $LASTEXITCODE } |