File size: 2,215 Bytes
0452a50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 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
}