fix: deploy site with tar stream
This commit is contained in:
@@ -11,11 +11,15 @@ if (-not (Test-Path $Dist)) {
|
|||||||
throw "dist/ does not exist. Run npm run build first."
|
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 ..."
|
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 ..."
|
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 ..."
|
Write-Host "Reloading Caddy ..."
|
||||||
ssh $Server "docker exec caddy caddy reload --config /etc/caddy/Caddyfile"
|
ssh $Server "docker exec caddy caddy reload --config /etc/caddy/Caddyfile"
|
||||||
|
|||||||
Reference in New Issue
Block a user