-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSitesCms deploy.ps1
67 lines (48 loc) · 1.46 KB
/
SitesCms deploy.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
& "C:\Program Files\7-Zip\7z.exe" a -ttar "C:\VSBuild\Cms\publish.tar" "C:\VSBuild\Cms\Publish\*"
$prepCommands = @"
mkdir -p -v /home/leo/Cms/publish;
rm -r /home/leo/Cms/publish/*
"@
$commands = @"
cd /home/leo/Cms;
tar -xf publish.tar --directory publish
rm -f publish.tar
chmod -R a+x publish;
docker rm -f SitesCms;
docker rmi sitescms:latest;
docker build --tag sitescms .;
docker run -p 8084:8080 --name SitesCms -h SitesCms --restart=always --network external -v /etc/SitesCms:/etc/SitesCms -v /var/www/sites-media:/var/www/sites-media -d sitescms:latest
"@
<# chown -R leo:leo /home/leo/Cms; #>
Write-Host "============== ContaboVPS ==============\r\n"
ssh ContaboVPS $prepCommands
scp C:\VSBuild\Cms\publish.tar ContaboVPS:/home/leo/Cms
scp C:\OneDrive\Projects\Cms\AleProjects.Cms.Web\Dockerfile ContaboVPS:/home/leo/Cms
ssh ContaboVPS $commands
$winscpResult = $LastExitCode
if ($winscpResult -eq 0)
{
Write-Host "Success"
}
else
{
Write-Host "Error"
}
<# #>
Write-Host "============== MiniAir11 ===============\r\n"
ssh MiniAir11 $prepCommands
scp C:\VSBuild\Cms\publish.tar MiniAir11:/home/leo/Cms
scp C:\OneDrive\Projects\Cms\AleProjects.Cms.Web\Dockerfile MiniAir11:/home/leo/Cms
ssh MiniAir11 $commands
$winscpResult = $LastExitCode
if ($winscpResult -eq 0)
{
Write-Host "Success"
}
else
{
Write-Host "Error"
}
Write-Host "========================================"
Remove-Item "C:\VSBuild\Cms\publish.tar" -Force -ErrorAction SilentlyContinue
Pause