fix: deploy site with tar stream

This commit is contained in:
ginnoir
2026-06-08 21:23:03 -05:00
parent 2c9fea622b
commit 0017a5d10c
+6 -2
View File
@@ -11,11 +11,15 @@ if (-not (Test-Path $Dist)) {
throw "dist/ does not exist. Run npm run build first."
}
if ([string]::IsNullOrWhiteSpace($RemotePath) -or -not $RemotePath.StartsWith("/config/caddy/site/")) {
throw "RemotePath must be under /config/caddy/site/."
}
Write-Host "Preparing remote site directory $RemotePath ..."
ssh $Server "mkdir -p '$RemotePath'"
ssh $Server "rm -rf '$RemotePath' && mkdir -p '$RemotePath'"
Write-Host "Syncing built site to ${Server}:$RemotePath ..."
scp -r (Join-Path $Dist "*") "${Server}:$RemotePath/"
tar -C $Dist -cf - . | ssh $Server "tar -C '$RemotePath' -xf -"
Write-Host "Reloading Caddy ..."
ssh $Server "docker exec caddy caddy reload --config /etc/caddy/Caddyfile"