forked from vpnhood/VpnHood
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_publish_docker.ps1
32 lines (27 loc) · 1.3 KB
/
_publish_docker.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
param([switch]$prerelease)
$projectDir = $PSScriptRoot;
. "$PSScriptRoot\..\Pub\Common.ps1" -prerelease:$prerelease
$packageName = "VpnHoodServer";
New-Item -Path $packagesServerDir -ItemType Directory -Force;
# server VpnHoodServer.docker.sh
echo "Make Server installation script for this docker"
$linuxScript = (Get-Content -Path "$PSScriptRoot/Install/VpnHoodServer.docker.sh" -Raw).Replace('$composeUrlParam', "https://github.com/vpnhood/VpnHood/releases/download/$versionTag/VpnHoodServer.docker.yml");
$linuxScript = $linuxScript -replace "`r`n", "`n";
$linuxScript | Out-File -FilePath "$packagesServerDir/VpnHoodServer.docker.sh" -Encoding ASCII -Force -NoNewline;
# copy compose file
Copy-Item -path "$projectDir\Install\VpnHoodServer.docker.yml" -Destination "$packagesServerDir\" -Force
# remove old docker containers from local
$serverDockerImage="vpnhood/vpnhoodserver";
docker rm -vf $(docker ps -a -q --filter "ancestor=$serverDockerImage")
docker rmi -f $(docker images -a -q "$serverDockerImage")
# create name image
docker build "$solutionDir" -f "$projectDir\Dockerfile" -t ${serverDockerImage}:latest -t ${serverDockerImage}:$versionTag
if ($prerelease)
{
docker push -t ${serverDockerImage}:$versionTag
}
else
{
#docker push ${serverDockerImage}:latest
#docker push ${serverDockerImage}:$versionTag
}