Speed up scratch image builds with publish-first contexts
This commit is contained in:
@@ -400,11 +400,16 @@ function Build-Solutions {
|
||||
|
||||
# ─── 6. Build Docker images ────────────────────────────────────────────────
|
||||
|
||||
function Build-Images {
|
||||
function Build-Images([switch]$PublishNoRestore) {
|
||||
Write-Step 'Building Docker images'
|
||||
$buildScript = Join-Path $Root 'devops/docker/build-all.ps1'
|
||||
if (Test-Path $buildScript) {
|
||||
& $buildScript
|
||||
$buildArguments = @()
|
||||
if ($PublishNoRestore) {
|
||||
$buildArguments += '-PublishNoRestore'
|
||||
}
|
||||
|
||||
& $buildScript @buildArguments
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Fail 'Docker image build failed.'
|
||||
exit 1
|
||||
@@ -600,7 +605,7 @@ if (-not $SkipBuild) {
|
||||
}
|
||||
|
||||
if (-not $SkipImages) {
|
||||
Build-Images
|
||||
Build-Images -PublishNoRestore:(-not $SkipBuild)
|
||||
}
|
||||
|
||||
Start-Platform
|
||||
|
||||
@@ -280,13 +280,14 @@ build_solutions() {
|
||||
# ─── 6. Build Docker images ────────────────────────────────────────────────
|
||||
|
||||
build_images() {
|
||||
local publish_no_restore="${1:-false}"
|
||||
step 'Building Docker images'
|
||||
local script="${ROOT}/devops/docker/build-all.sh"
|
||||
if [[ -x "$script" ]]; then
|
||||
"$script"
|
||||
PUBLISH_NO_RESTORE="$publish_no_restore" "$script"
|
||||
ok 'Docker images built successfully'
|
||||
elif [[ -f "$script" ]]; then
|
||||
bash "$script"
|
||||
PUBLISH_NO_RESTORE="$publish_no_restore" bash "$script"
|
||||
ok 'Docker images built successfully'
|
||||
else
|
||||
warn "Build script not found at $script. Skipping image build."
|
||||
@@ -377,7 +378,7 @@ check_prerequisites
|
||||
check_hosts
|
||||
|
||||
if [[ "$IMAGES_ONLY" == "true" ]]; then
|
||||
build_images
|
||||
build_images false
|
||||
echo ''
|
||||
echo 'Done (images only).'
|
||||
exit 0
|
||||
@@ -398,7 +399,11 @@ if [[ "$SKIP_BUILD" != "true" ]]; then
|
||||
fi
|
||||
|
||||
if [[ "$SKIP_IMAGES" != "true" ]]; then
|
||||
build_images
|
||||
if [[ "$SKIP_BUILD" == "true" ]]; then
|
||||
build_images false
|
||||
else
|
||||
build_images true
|
||||
fi
|
||||
fi
|
||||
|
||||
start_platform
|
||||
|
||||
Reference in New Issue
Block a user