-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-and-deploy.ps1
27 lines (23 loc) · 1.05 KB
/
build-and-deploy.ps1
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
# Run Maven clean install
Write-Host "Running 'mvn clean install'"
$mavenResult = Start-Process -FilePath "mvn" -ArgumentList "clean install" -NoNewWindow -Wait -PassThru
# Check if Maven build was successful
if ($mavenResult.ExitCode -eq 0) {
Write-Host "Maven build successful"
# Run Docker Compose build
Write-Host "Running 'docker-compose build'"
$dockerBuildResult = Start-Process -FilePath "docker-compose" -ArgumentList "build" -NoNewWindow -Wait -PassThru
# Check if Docker Compose build was successful
if ($dockerBuildResult.ExitCode -eq 0) {
Write-Host "Docker Compose build successful"
# Run Docker Compose up
Write-Host "Running 'docker-compose up'"
Start-Process -FilePath "docker-compose" -ArgumentList "up" -NoNewWindow -Wait
} else {
Write-Host "Docker Compose build failed with exit code $($dockerBuildResult.ExitCode)"
Exit $dockerBuildResult.ExitCode
}
} else {
Write-Host "Maven build failed with exit code $($mavenResult.ExitCode)"
Exit $mavenResult.ExitCode
}