-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-geode.ps1
More file actions
55 lines (45 loc) · 1.92 KB
/
build-geode.ps1
File metadata and controls
55 lines (45 loc) · 1.92 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
48
49
50
51
52
53
54
55
<#
.SYNOPSIS
Builds the Java project, copies the necessary JAR file, and builds the
custom Geode Docker image for local Kubernetes deployment.
.DESCRIPTION
This script automates the following steps:
1. Runs 'mvn clean install' from the 'broadcast-microservice' directory.
2. Copies the resulting 'broadcast-geode-shared-1.0.0.jar' to the 'geode-scripts' directory.
3. Builds the custom Geode Docker image tagged as 'custom-geode:1.0'.
#>
# Exit the script immediately if any command fails
$ErrorActionPreference = "Stop"
# --- Script Logic ---
Write-Host ">>> Step 1: Building the Java microservices..." -ForegroundColor Green
Push-Location -Path "broadcast-microservice"
try {
mvn clean install
}
finally {
Pop-Location
}
Write-Host ">>> Java build complete." -ForegroundColor Green
Write-Host "`n>>> Step 2: Copying shared JAR to geode-scripts..." -ForegroundColor Green
$sourceJar = "broadcast-microservice/broadcast-geode-shared/target/broadcast-geode-shared-1.0.0.jar"
$destinationJar = "geode-scripts/broadcast-geode-shared-1.0.0.jar"
# Check if the source JAR exists before copying
if (-not (Test-Path $sourceJar)) {
Write-Host "ERROR: Source JAR not found at '$sourceJar'. The Maven build may have failed." -ForegroundColor Red
exit 1
}
Copy-Item -Path $sourceJar -Destination $destinationJar -Force
Write-Host ">>> JAR copied successfully." -ForegroundColor Green
Write-Host "`n>>> Step 3: Building the custom Geode Docker image..." -ForegroundColor Green
$imageName = "custom-geode:1.0"
Push-Location -Path "geode-scripts"
try {
docker build -t $imageName .
}
finally {
Pop-Location
}
Write-Host ">>> Docker image build complete." -ForegroundColor Green
Write-Host "`n✅ Build process finished." -ForegroundColor Green
Write-Host "The Docker image '$imageName' is now available locally."
Write-Host "Ensure your Kubernetes deployments are using this image name and 'imagePullPolicy: IfNotPresent'."