Skip to content
This repository was archived by the owner on Mar 11, 2020. It is now read-only.

Commit 39c9c0b

Browse files
committed
Update iis generate
Added new WindowsOptionalFeatures to comply with needed features to add a webste. Fixed a number of problems with the `RUN` commands that were causing issues like badly parsed strings etc. on `docker build`.
1 parent 06eb127 commit 39c9c0b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Artifacts/IIS/Generate.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ $Artifact = Get-Content -Path $Manifest -Raw | ConvertFrom-Json
2121
if ($Artifact.Status -eq 'Present') {
2222
$Result = '
2323
RUN powershell.exe -ExecutionPolicy Bypass -Command \
24-
Enable-WindowsOptionalFeature -Online -FeatureName Web-Server, IIS-WebServerManagementTools; \
25-
'
24+
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebserverRole, IIS-WebServer, IIS-WebServerManagementTools;'
2625
$Add = "`r`n"
2726
[int]$SiteCount = $Artifact.Websites.name.Length;
2827
for ($i=0;$i -lt $SiteCount;$i++){
2928
Write-Verbose -Message ('Creating new website for {0} site' -f $Artifact.Websites.Name[$i])
3029
$SitePath = ($Artifact.Websites.MountPath + '\' + (Split-Path $Artifact.Websites.PhysicalPath[$i] -NoQualifier)) -replace '\\%SystemDrive%\\', "\"
31-
$Result += 'New-Website -Name "{0}" -PhysicalPath "{1}" \{2}' -f $Artifact.Websites.Name[$i], $Artifact.Websites.PhysicalPath[$i], "`r`n"
30+
$Result += '\{1}New-Item -Path {0} -ItemType directory; \{1}' -f $Artifact.Websites.PhysicalPath[$i], "`r`n"
31+
$Result += 'New-Website -Name ''{0}'' -PhysicalPath "{1}";' -f ($Artifact.Websites.Name[$i] -replace "'","''"), $Artifact.Websites.PhysicalPath[$i], "`r`n"
3232
Write-Verbose -Message ('Copying files for {0} site' -f $Artifact.Websites.Name[$i])
3333
Copy-Item $SitePath $ManifestPath
3434
$Add += "ADD {0} {1}`r`n" -f (Split-Path $Artifact.Websites.PhysicalPath[$i] -Leaf),$Artifact.Websites.PhysicalPath[$i]

0 commit comments

Comments
 (0)