-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-docker-compose-windows.ps1
40 lines (34 loc) · 1.14 KB
/
run-docker-compose-windows.ps1
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
# Define the path to the .env file
$envPath = ".\.env"
# Check if the .env file exists
if (Test-Path $envPath) {
# Read the .env file
$envContent = Get-Content $envPath
# Parse the environment variables
foreach ($line in $envContent) {
if ($line -match '^([^=]+)=(.*)$') {
$name = $matches[1]
$value = $matches[2]
[Environment]::SetEnvironmentVariable($name, $value, "Process")
Write-Host "Loaded environment variable: $name"
}
}
# Stop existing containers
Write-Host "Stopping existing containers..."
docker-compose down
# Rebuild the container
Write-Host "Rebuilding Docker containers..."
docker-compose build --no-cache app
# Start the services
Write-Host "Starting Docker services..."
docker-compose up -d
# Wait for services to be ready
Write-Host "Waiting for services to start up..."
Start-Sleep -Seconds 20
# Run the Streamlit app
Write-Host "Starting Streamlit app..."
docker-compose exec -T app sh -c "cd /app/app && streamlit run main.py"
}
else {
Write-Error "The .env file was not found at $envPath"
}