schon/scripts/Windows/install.ps1
Egor fureunoir Gorbunov 118882ac1b Features: 1) Add new make-messages.ps1 and compile-messages.ps1 scripts for Windows localization workflow; 2) Update Docker ENTRYPOINT scripts to use bash for app, worker, stock_updater, and beat containers; 3) Bump project version to 2.9.1 in pyproject.toml and settings;
Fixes: 1) Ensure `install.ps1` handles non-zero exit codes gracefully; 2) Remove redundant `vm.overcommit_memory` Docker sysctl setting; 3) Add explicit exit command to `starter.ps1` for clean terminations;

Extra: Minor formatting and consistency improvements across ENTRYPOINT scripts;
2025-07-03 18:33:37 +03:00

46 lines
1.2 KiB
PowerShell

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
.\scripts\Windows\starter.ps1
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
if (-not (Test-Path '.env'))
{
Write-Warning ".env file not found. Exiting without running Docker steps."
exit 0
}
$cpuCount = [Environment]::ProcessorCount
if ($cpuCount -lt 4)
{
exit 1
}
$totalMemBytes = (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory
$totalMemGB = [Math]::Round($totalMemBytes / 1GB, 2)
if ($totalMemGB -lt 6)
{
exit 1
}
$currentDrive = Split-Path -Qualifier $PWD
$driveLetter = $currentDrive.Substring(0, 1)
$freeGB = [Math]::Round((Get-PSDrive -Name $driveLetter).Free / 1GB, 2)
if ($freeGB -lt 20)
{
exit 1
}
Write-Host "System requirements met: CPU cores=$cpuCount, RAM=${totalMemGB}GB, FreeDisk=${freeGB}GB" -ForegroundColor Green
Write-Host "Pulling images" -ForegroundColor Magenta
docker compose pull
Write-Host "Images pulled successfully" -ForegroundColor Green
Write-Host "Building images" -ForegroundColor Magenta
docker compose build
Write-Host "Images built successfully" -ForegroundColor Green
Write-Host ""
Write-Host "You can now use run.ps1 script." -ForegroundColor Cyan