| 123456789101112131415161718192021222324252627282930313233 |
- param(
- [Parameter(Mandatory = $true)]
- [string]$Module,
- [Parameter(Mandatory = $true)]
- [string]$Namespace,
- [string]$Tag = "1.1.0",
- [switch]$SkipMaven
- )
- $ErrorActionPreference = "Stop"
- $JavaRoot = Split-Path -Parent $PSScriptRoot
- $ModuleDir = Join-Path $JavaRoot $Module
- $JarPath = Join-Path $ModuleDir "target/$Module.jar"
- $Image = "ccr.ccs.tencentyun.com/$Namespace/${Module}:$Tag"
- Set-Location $JavaRoot
- if (-not $SkipMaven) {
- Write-Host "Maven packaging $Module ..."
- mvn -pl $Module -am clean package -DskipTests -B
- if ($LASTEXITCODE -ne 0) { throw "Maven build failed: $Module" }
- }
- if (-not (Test-Path $JarPath)) {
- throw "Jar not found: $JarPath. Run: mvn -pl $Module -am clean package -DskipTests"
- }
- Write-Host "Building $Image ..."
- Set-Location $ModuleDir
- docker build -t $Image .
- if ($LASTEXITCODE -ne 0) { throw "Docker build failed: $Module" }
- Write-Host "Done: $Image"
|