Files

16 lines
1.0 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$projectPath = Split-Path $PSScriptRoot -Parent
$archiveName = 'questiongraph-' + [guid]::NewGuid().ToString('N') + '.tar'
$archivePath = Join-Path ([System.IO.Path]::GetTempPath()) $archiveName
$remotePath = '/tmp/' + $archiveName
# Explicit inputs avoid uploading neighbouring repositories, secrets, or dependencies.
tar -cf $archivePath -C $projectPath Dockerfile .dockerignore deploy src scripts tests package.json package-lock.json tsconfig.json vite.config.ts index.html README.md
if ($LASTEXITCODE -ne 0) { throw 'Could not create deployment archive.' }
scp $archivePath "root@peterstockings.com:$remotePath"
if ($LASTEXITCODE -ne 0) { throw 'Could not upload deployment archive.' }
ssh root@peterstockings.com "dokku git:from-archive questiongraph -- < $remotePath"
if ($LASTEXITCODE -ne 0) { throw 'Dokku deployment failed. Check the build output.' }
Write-Output 'Deployed: https://questiongraph.peterstockings.com'
Write-Output "Deployment archive retained locally at $archivePath and remotely at $remotePath"