forked from rogerfar/rdt-client
-
Notifications
You must be signed in to change notification settings - Fork 5
/
docker-build-dev.ps1
executable file
·31 lines (23 loc) · 1012 Bytes
/
docker-build-dev.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
#!/usr/bin/env pwsh
param(
[string]$TempPath="c:/Temp/RtdClient",
[string]$Dockerfile="Dockerfile",
[switch]$AutoAttach,
[switch]$SkipCache,
[string]$BuildProgress="auto"
)
[string] $downloadPath = Join-Path -Path $TempPath -ChildPath "downloads"
[string] $dbPath = Join-Path -Path $TempPath -ChildPath "db"
Write-Host "Stopping Container (if already running)"
docker stop rdtclientdev
Write-Host "removing Container (if exists)"
docker rm rdtclientdev
Write-Host "Building Container"
$dockerArgs = @( "build", "--force-rm", "--tag", "rdtclientdev", "--progress=$BuildProgress", "--file", $Dockerfile, "." )
if ($SkipCache.IsPresent) { $dockerArgs += @("--no-cache" ) }
& docker $dockerArgs
Write-Host "Starting Container"
& docker run --cap-add=NET_ADMIN -d -v ${$downloadPath}:/data/downloads -v ${$dbPath}:/data/db --log-driver json-file --log-opt max-size=10m -p 6500:6500 --name rdtclientdev rdtclientdev
if ($AutoAttach.IsPresent) {
docker exec -it rdtclientdev /bin/bash
}