Add deploy tooling, docs, and Aspire config
This commit is contained in:
49
deploy/push-images.ps1
Normal file
49
deploy/push-images.ps1
Normal file
@@ -0,0 +1,49 @@
|
||||
param(
|
||||
[string] $Environment = "Production",
|
||||
[string] $AppHostPath = "",
|
||||
[string] $OutputPath = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($AppHostPath)) {
|
||||
$AppHostPath = Join-Path $PSScriptRoot "../src/AppHost/AppHost.csproj"
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($OutputPath)) {
|
||||
$OutputPath = Join-Path $PSScriptRoot "aspire-output"
|
||||
}
|
||||
|
||||
$envPath = Join-Path $PSScriptRoot ".env"
|
||||
if (Test-Path $envPath) {
|
||||
Get-Content $envPath | Where-Object { $_ -and $_ -notmatch '^\s*#' } | ForEach-Object {
|
||||
$name, $value = $_ -split '=', 2
|
||||
if (-not [string]::IsNullOrWhiteSpace($name) -and [string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($name))) {
|
||||
[Environment]::SetEnvironmentVariable($name, $value, 'Process')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$requiredEnvironmentVariables = @(
|
||||
"REGISTRY_USERNAME",
|
||||
"REGISTRY_TOKEN",
|
||||
"REGISTRY_REPOSITORY"
|
||||
)
|
||||
|
||||
$missing = $requiredEnvironmentVariables | Where-Object { [string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($_)) }
|
||||
if ($missing.Count -gt 0) {
|
||||
throw "Missing required environment variables: $($missing -join ', '). Load deploy/.env values before running this script."
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($env:IMAGE_TAG)) {
|
||||
$env:IMAGE_TAG = "latest"
|
||||
}
|
||||
|
||||
$env:REGISTRY_ENDPOINT = "git.recroomarchive.org"
|
||||
|
||||
$env:REGISTRY_TOKEN | docker login $env:REGISTRY_ENDPOINT -u $env:REGISTRY_USERNAME --password-stdin
|
||||
|
||||
aspire do push `
|
||||
--apphost $AppHostPath `
|
||||
--environment $Environment `
|
||||
--output-path $OutputPath
|
||||
Reference in New Issue
Block a user