-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild-docker.ps1
34 lines (27 loc) · 916 Bytes
/
build-docker.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
28
29
30
31
32
33
34
# Build and Run Script for PALWorld Save Pal
# Navigate to the script's directory
Set-Location -Path $PSScriptRoot
# Function to get the most appropriate IP address
function Get-BestIPAddress {
$ipAddresses = Get-NetIPAddress -AddressFamily IPv4 |
Where-Object {
$_.IPAddress -ne '127.0.0.1' -and
$_.IPAddress -notlike '169.254.*' -and
$_.IPAddress -notlike '172.*'
} |
Sort-Object -Property { $_.PrefixOrigin -ne 'Manual' }, PrefixLength
if ($ipAddresses) {
return $ipAddresses[0].IPAddress
}
else {
Write-Error "No suitable IP address found. Exiting."
exit 1
}
}
# Get the IP address
$IPAddress = Get-BestIPAddress
Write-Host "Using IP Address: $IPAddress"
# Build and run docker compose
docker-compose build --build-arg PUBLIC_WS_URL=$IPAddress
docker-compose up -d
Write-Host "Build and deployment completed successfully."