<# .SYNOPSIS Construit l'image Docker avec toutes les dépendances requises via PowerShell et WSL (Debian). .DESCRIPTION Ce script prépare les dépendances et construit l'image Docker sous WSL (Debian). .PARAMETRES -full : Si présent, effectue une construction complète de l'image Docker (équivalent à --no-cache). .EXEMPLE .\build-img.ps1 # Construction rapide (avec cache) .\build-img.ps1 -full # Construction complète sans cache .RETOURNE Affiche le succès ou les erreurs pendant la construction de l'image Docker. #> param( [switch]$full ) $ErrorActionPreference = 'Stop' try { # Determine paths $scriptDir = $PSScriptRoot $projectRoot = (Get-Item (Join-Path $scriptDir '..')).FullName # Convert Windows path to WSL path (manual, no wslpath) $wslProjectRoot = $projectRoot -replace '^([A-Za-z]):\\','/mnt/$1/' -replace '\\','/' $wslProjectRoot = $wslProjectRoot.ToLower() # Compose build command $noCache = if ($full) { '--no-cache' } else { '' } $innerCmd = "cd '$wslProjectRoot' && docker build $noCache -t newtube-angular:latest -f docker/Dockerfile.origi ." # Run build inside WSL Debian to use Linux Docker daemon wsl -d Debian bash -lc $innerCmd Write-Host "Image Docker newtube-angular:latest construite avec succès via WSL Debian." -ForegroundColor Green } catch { Write-Error "Erreur lors de la construction de l'image Docker : $_" exit 1 }