You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
recyclarr/docker/BuildAndRun.ps1

49 lines
1.1 KiB

[CmdletBinding()]
param (
[string] $Runtime = "linux-musl-x64",
[string[]] $RunArgs
)
$ErrorActionPreference = "Stop"
$artifactsDir = "$PSScriptRoot\artifacts"
# Delete old build artifacts
Remove-Item $artifactsDir -Recurse -Force -ErrorAction SilentlyContinue
# Publish new build artifacts
Push-Location $PSScriptRoot\..
try {
& .\ci\Publish.ps1 -NoSingleFile `
-OutputDir "$artifactsDir\$Runtime" `
-Runtime $Runtime
}
finally {
Pop-Location
}
# Start the corresponding radarr/sonarr docker containers for testing/debugging
Push-Location "$PSScriptRoot\..\debugging"
try {
docker compose up -d --pull always
if ($LASTEXITCODE -ne 0) {
throw "docker compose up failed"
}
}
finally {
Pop-Location
}
# Finally, build the docker image and run it
docker compose build
if ($LASTEXITCODE -ne 0) {
throw "docker compose build failed"
}
# TODO: Use `--build` when it releases:
# https://github.com/docker/compose/issues/10003
docker compose run --rm recyclarr @RunArgs
if ($LASTEXITCODE -ne 0) {
throw "docker compose run failed"
}