-
Notifications
You must be signed in to change notification settings - Fork 154
/
Dockerfile
46 lines (39 loc) · 1.9 KB
/
Dockerfile
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
# escape=`
ARG fromTag=7.0.3-windowsservercore-1903
ARG pesterMinVer=5.0.2
FROM mcr.microsoft.com/powershell:${fromTag}
SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"]
RUN pwsh `
-NoLogo `
-NoProfile `
-Command " `
`Write-host 'Installing needed PowerShell modules...'; `
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted; `
Install-Module -Name 'Trackyon.Utils', 'PSScriptAnalyzer', 'Plaster', 'SHiPS' -SkipPublisherCheck; `
Install-Module -Name Pester -Force -AllowPrerelease -MinimumVersion "$env:pesterMinVer" -AllowClobber -SkipPublisherCheck; `
"
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]
# install nuget in PS 5.1
# in this version nuget is not installed and registered, but is needed to install all other modules from PSGallery
# also PowerShellGet is not on the newest version e.g. Install-Module would not acccept version numbers like 5.0.2
RUN powershell `
-NoLogo `
-Command " `
`Write-host 'Installing nuget, .net core SDK and PowerShellGet...'; `
Set-ExecutionPolicy Bypass -Scope Process -Force; `
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); `
choco install nuget.commandline dotnetcore-sdk -y; `
Install-PackageProvider -Name NuGet -Force; `
Install-Module -Name PowerShellGet -Force; `
Update-Module -Name PowerShellGet; `
"
# install all modules for PS 5.1 as well
RUN powershell `
-NoLogo `
-Command " `
`Write-host 'Installing needed PowerShell modules...'; `
Install-Module -Name 'Trackyon.Utils', 'PSScriptAnalyzer', 'Plaster', 'SHiPS' -SkipPublisherCheck; `
Install-Module -Name Pester -Repository PSGallery -Force -AllowPrerelease -MinimumVersion "$env:pesterMinVer" -AllowClobber -SkipPublisherCheck;`
"
CMD ["pwsh.exe"]