# PowerShell script to run IntegraChat Docker container # Stop and remove existing container if it exists Write-Host "Checking for existing container..." -ForegroundColor Yellow $existing = docker ps -a --filter "name=integrachat" --format "{{.Names}}" 2>&1 if ($existing -eq "integrachat") { Write-Host "Removing existing container (force)..." -ForegroundColor Yellow # Use -f to force remove (stops and removes in one command) docker rm -f integrachat 2>&1 | Out-Null Start-Sleep -Seconds 1 } # Build the image Write-Host "Building Docker image (this may take a few minutes)..." -ForegroundColor Green Write-Host "Progress will be shown below..." -ForegroundColor Gray docker build -t integrachat:latest . if ($LASTEXITCODE -ne 0) { Write-Host "Build failed! Check the error messages above." -ForegroundColor Red exit 1 } Write-Host "Build completed successfully!" -ForegroundColor Green # Check if .env file exists if (-not (Test-Path .env)) { Write-Host "Warning: .env file not found. Creating from env.example..." -ForegroundColor Yellow if (Test-Path env.example) { Copy-Item env.example .env Write-Host "Created .env file. Please update it with your configuration." -ForegroundColor Yellow } else { Write-Host "Error: env.example not found. Cannot create .env file." -ForegroundColor Red exit 1 } } # Run the container Write-Host "Starting container..." -ForegroundColor Green docker run -d --name integrachat ` -p 7860:7860 ` -p 8000:8000 ` -p 8900:8900 ` --env-file .env ` -e DOCKER_CONTAINER=1 ` integrachat:latest if ($LASTEXITCODE -eq 0) { Write-Host "Container started successfully!" -ForegroundColor Green Write-Host "" Write-Host "Access services:" -ForegroundColor Cyan Write-Host " - Gradio UI: http://localhost:7860" -ForegroundColor White Write-Host " - FastAPI: http://localhost:8000" -ForegroundColor White Write-Host " - MCP Server: http://localhost:8900" -ForegroundColor White Write-Host "" Write-Host "View logs: docker logs -f integrachat" -ForegroundColor Yellow } else { Write-Host "Failed to start container!" -ForegroundColor Red exit 1 }