Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-08-05 10:05:20 +02:00
parent 61f1e59964
commit f96ed670ca
239 changed files with 23858 additions and 730 deletions
+113
View File
@@ -0,0 +1,113 @@
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Manual push of Docker image to Gitea Registry
.DESCRIPTION
Pushes the local tradingbot:latest image to Gitea Registry with proper tags
Use this when Visual Studio Publish was done without Docker running
#>
param(
[string]$Version = "1.3.0"
)
$ErrorActionPreference = "Stop"
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "?? Manual Gitea Registry Push" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Check Docker
Write-Host "?? Checking Docker..." -ForegroundColor Yellow
try {
docker version | Out-Null
Write-Host "? Docker is running" -ForegroundColor Green
} catch {
Write-Host "? Docker is not running!" -ForegroundColor Red
Write-Host " Please start Docker Desktop first" -ForegroundColor Yellow
exit 1
}
Write-Host ""
# Check local image exists
Write-Host "?? Checking local image..." -ForegroundColor Yellow
$localImage = docker images --format "{{.Repository}}:{{.Tag}}" | Select-String "^tradingbot:latest$"
if (-not $localImage) {
Write-Host "? Local image 'tradingbot:latest' not found!" -ForegroundColor Red
Write-Host " Please run Visual Studio Publish first" -ForegroundColor Yellow
exit 1
}
Write-Host "? Local image found: tradingbot:latest" -ForegroundColor Green
Write-Host ""
# Configuration
$registry = "gitea.encke-hake.ts.net"
$repository = "alby96/encelado/tradingbot"
$giteaImage = "$registry/$repository"
$buildDate = Get-Date -Format "yyyyMMdd"
$versionedTag = "$Version-$buildDate"
Write-Host "?? Version: $Version" -ForegroundColor Cyan
Write-Host "?? Build Date: $buildDate" -ForegroundColor Cyan
Write-Host ""
# Create tags
Write-Host "??? Creating tags..." -ForegroundColor Yellow
Write-Host " Tagging: ${giteaImage}:latest" -ForegroundColor Gray
docker tag tradingbot:latest "${giteaImage}:latest"
Write-Host " ? latest" -ForegroundColor Green
Write-Host " Tagging: ${giteaImage}:$Version" -ForegroundColor Gray
docker tag tradingbot:latest "${giteaImage}:$Version"
Write-Host " ? $Version" -ForegroundColor Green
Write-Host " Tagging: ${giteaImage}:$versionedTag" -ForegroundColor Gray
docker tag tradingbot:latest "${giteaImage}:$versionedTag"
Write-Host " ? $versionedTag" -ForegroundColor Green
Write-Host ""
# Push to Gitea
Write-Host "?? Pushing to $registry..." -ForegroundColor Yellow
Write-Host ""
Write-Host " Pushing: latest..." -ForegroundColor Gray
docker push "${giteaImage}:latest"
Write-Host " ? Pushed: latest" -ForegroundColor Green
Write-Host " Pushing: $Version..." -ForegroundColor Gray
docker push "${giteaImage}:$Version"
Write-Host " ? Pushed: $Version" -ForegroundColor Green
Write-Host " Pushing: $versionedTag..." -ForegroundColor Gray
docker push "${giteaImage}:$versionedTag"
Write-Host " ? Pushed: $versionedTag" -ForegroundColor Green
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "? Successfully pushed to Gitea Registry!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "?? Published images:" -ForegroundColor Cyan
Write-Host " - ${giteaImage}:latest" -ForegroundColor White
Write-Host " - ${giteaImage}:$Version" -ForegroundColor White
Write-Host " - ${giteaImage}:$versionedTag" -ForegroundColor White
Write-Host ""
Write-Host "?? Verify at:" -ForegroundColor Cyan
Write-Host " https://$registry/Alby96/Encelado/-/packages" -ForegroundColor White
Write-Host ""
Write-Host "?? Next steps:" -ForegroundColor Cyan
Write-Host " 1. Verify on Gitea Packages (link above)" -ForegroundColor White
Write-Host " 2. SSH to Unraid: ssh root@192.168.30.23" -ForegroundColor White
Write-Host " 3. Force update:" -ForegroundColor White
Write-Host " docker stop TradingBot" -ForegroundColor Gray
Write-Host " docker rmi $giteaImage:latest" -ForegroundColor Gray
Write-Host " docker pull $giteaImage:latest" -ForegroundColor Gray
Write-Host " docker start TradingBot" -ForegroundColor Gray
Write-Host ""