40 lines
1.4 KiB
PowerShell
40 lines
1.4 KiB
PowerShell
#!/usr/bin/env pwsh
|
|
# Build script for PISCAL Docker image with automatic versioning
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
# Generate version tag: YYYYMMDD-gitsha
|
|
$DateTag = Get-Date -Format "yyyyMMdd"
|
|
$GitSha = (git rev-parse --short HEAD).Trim()
|
|
$Version = "$DateTag-$GitSha"
|
|
|
|
Write-Host "Building PISCAL Docker image..." -ForegroundColor Cyan
|
|
Write-Host "Version: $Version" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Build with version tag and latest tag (using default ARGs for dev)
|
|
docker build `
|
|
-t "piscal:$Version" `
|
|
-t piscal:latest `
|
|
-t piscal:dev `
|
|
.
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host ""
|
|
Write-Host "Successfully built:" -ForegroundColor Green
|
|
Write-Host " - piscal:$Version" -ForegroundColor Green
|
|
Write-Host " - piscal:latest" -ForegroundColor Green
|
|
Write-Host " - piscal:dev" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Default credentials:" -ForegroundColor Cyan
|
|
Write-Host " Username: piscaladmin" -ForegroundColor Cyan
|
|
Write-Host " Password: piscaladmin" -ForegroundColor Cyan
|
|
Write-Host " Storage: /home/piscaladmin/LeafWeb_storage" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "To run: docker run -d -p 2222:22 --name piscal-server piscal:latest" -ForegroundColor Yellow
|
|
Write-Host "To SSH: ssh -p 2222 piscaladmin@localhost (password: piscaladmin)" -ForegroundColor Yellow
|
|
} else {
|
|
Write-Host "Build failed!" -ForegroundColor Red
|
|
exit $LASTEXITCODE
|
|
}
|