-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathup.ps1
More file actions
48 lines (38 loc) · 1.79 KB
/
up.ps1
File metadata and controls
48 lines (38 loc) · 1.79 KB
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
# Script pour démarrer le projet avec cache busting automatique
# Usage: .\up.ps1 [options docker-compose]
# Exemples:
# .\up.ps1 # Démarre tous les services
# .\up.ps1 -d # Démarre en mode détaché
# .\up.ps1 --build # Force le rebuild
# .\up.ps1 -d --build # Rebuild + mode détaché
$ErrorActionPreference = "Stop"
# Générer un cache bust unique (timestamp)
$CACHE_BUST = [int][double]::Parse((Get-Date -UFormat %s))
Write-Host "🚀 Starting WhatsApp Automation System" -ForegroundColor Cyan
Write-Host "📦 CACHE_BUST=$CACHE_BUST (ensures code changes are included)" -ForegroundColor Yellow
# Définir la variable d'environnement pour cette session
$env:CACHE_BUST = $CACHE_BUST
# Construire les arguments pour docker-compose
$upArgs = @("up") + $args
# Vérifier si --build est déjà présent
$hasBuildFlag = $args -contains "--build" -or $args -contains "-b"
# Si aucun argument n'est fourni, ajouter -d par défaut
if ($args.Count -eq 0) {
Write-Host "💡 No arguments provided, starting in detached mode (-d)" -ForegroundColor Yellow
$upArgs += "-d"
}
# Exécuter docker-compose up
Write-Host "🔨 Executing: docker-compose $($upArgs -join ' ')" -ForegroundColor Green
& docker-compose $upArgs
if ($LASTEXITCODE -eq 0) {
Write-Host ""
Write-Host "Services started successfully!" -ForegroundColor Green
Write-Host "View logs: docker-compose logs -f" -ForegroundColor Yellow
Write-Host "Frontend: http://localhost:5173" -ForegroundColor Yellow
Write-Host "API: http://localhost:3000" -ForegroundColor Yellow
Write-Host "Stop: docker-compose down" -ForegroundColor Yellow
} else {
Write-Host ""
Write-Host "Failed to start services (exit code $LASTEXITCODE)" -ForegroundColor Red
exit $LASTEXITCODE
}