Skip to content

Commit

Permalink
Merge pull request #13 from Ben-m-s/develop
Browse files Browse the repository at this point in the history
Data folder (and license.xml) as volume among other
  • Loading branch information
jeanfrancoislarente authored Mar 27, 2018
2 parents 36b5dfa + fbc5838 commit 5ef1b3a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 11 deletions.
22 changes: 17 additions & 5 deletions sitecore/9.0.1 rev. 171219 XM1 CD/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ FROM microsoft/aspnet:4.7.1-windowsservercore-1709
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ENV SITENAME='sc'
ENV SITEPATH=C:\inetpub\${SITENAME}
ENV SITEPATH=C:\inetpub\${SITENAME}\Website
ENV DATAPATH=C:\inetpub\${SITENAME}\Data
ARG SQLADMIN_PASSWORD='HASH-epsom-sunset-cost7!'
ARG INSTALL_TEMP='c:\\install'
ARG SIF_CONFIG=${INSTALL_TEMP}\\sitecore-XM1-cd.json
Expand All @@ -30,7 +31,9 @@ RUN Start-Process msiexec.exe -ArgumentList '/i', $env:WEBDEPLOY_MSI, '/quiet',
RUN Expand-Archive -Path (Join-Path $env:INSTALL_TEMP '*.zip') -DestinationPath $env:INSTALL_TEMP; `
Expand-Archive -Path (Join-Path $env:INSTALL_TEMP '*Configuration files*.zip') -DestinationPath $env:INSTALL_TEMP; `
$config = Get-Content $env:SIF_CONFIG | Where-Object { $_ -notmatch '^\s*\/\/'} | Out-String | ConvertFrom-Json; `
$config.Tasks.CreatePaths.Params.Exists += '[variable(''Site.DataFolder'')]'; `
$config.Variables.'Site.PhysicalPath' = $env:SITEPATH; `
$config.Variables.'Site.DataFolder' = $env:DATAPATH; `
ConvertTo-Json $config -Depth 50 | Set-Content -Path $env:SIF_CONFIG; `
Remove-Website -Name 'Default Web Site'; `
Install-SitecoreConfiguration -Path $env:SIF_CONFIG `
Expand All @@ -49,15 +52,24 @@ RUN Expand-Archive -Path (Join-Path $env:INSTALL_TEMP '*.zip') -DestinationPath
-SolrCorePrefix $env:SITENAME `
-Skip "CreateHostHeader", "CreateBindings", "StartAppPool", "StartWebsite"; `
Remove-Item -Path 'C:\\*.log'; `
Remove-Item -Path ('{0}\\App_Data\\logs' -f $env:SITEPATH) -Force -Recurse; `
Copy-Item -Path (Join-Path $env:INSTALL_TEMP '\\Sitecore') -Destination 'C:/' -Recurse -Force; `
Set-WebConfiguration -PSPath ('IIS:\Sites\{0}' -f $env:SITENAME) -Filter '/system.web/customErrors/@mode' -Value 'Off'
Set-WebConfiguration -PSPath ('IIS:\Sites\{0}' -f $env:SITENAME) -Filter '/system.web/customErrors/@mode' -Value 'Off'; `
$xml = New-Object XML; `
$xml.Load(('{0}\app_config\include\examples\DataFolder.config.example' -f $env:SITEPATH)); `
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable); `
$nsm.AddNamespace('patch', 'http://www.sitecore.net/xmlconfig/'); `
$element = $xml.SelectSingleNode('//sc.variable[@name=''dataFolder'']/patch:attribute[@name=''value'']', $nsm); `
$element.InnerText=$env:DATAPATH; `
$xml.Save(('{0}\app_config\include\DataFolder.config' -f $env:SITEPATH));

# Cleanup, post installation tweaks and start site
RUN Start-Process msiexec.exe -ArgumentList '/x', $env:WEBDEPLOY_MSI, '/quiet', '/norestart' -NoNewWindow -Wait; `
Uninstall-Module SitecoreInstallFramework -Force; `
Remove-Item -Path $env:INSTALL_TEMP -Force -Recurse; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord; `
setx /M PATH $($env:PATH + ';C:\Sitecore\Scripts'); `
Start-WebAppPool -Name $env:SITENAME; `
Start-Website -Name $env:SITENAME
Start-Website -Name $env:SITENAME; `
Remove-Item -Path $env:INSTALL_TEMP -Force -Recurse; `
Remove-Item -Path $env:DATAPATH -Force -Recurse;

VOLUME ${DATAPATH}
25 changes: 19 additions & 6 deletions sitecore/9.0.1 rev. 171219 XM1 CM/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ FROM microsoft/aspnet:4.7.1-windowsservercore-1709
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ENV SITENAME='sc'
ENV SITEPATH=C:\inetpub\${SITENAME}
ENV SITEPATH=C:\inetpub\${SITENAME}\Website
ENV DATAPATH=C:\inetpub\${SITENAME}\Data
ARG SQLADMIN_PASSWORD='HASH-epsom-sunset-cost7!'
ARG INSTALL_TEMP='c:\\install'
ARG SIF_CONFIG=${INSTALL_TEMP}\\sitecore-XM1-cm.json
Expand All @@ -24,14 +25,16 @@ RUN Start-Process msiexec.exe -ArgumentList '/i', $env:WEBDEPLOY_MSI, '/quiet',
Start-Process $env:VCREDISTX64_EXE -ArgumentList '/install', '/passive', '/norestart' -NoNewWindow -Wait; `
Install-PackageProvider -Name NuGet -Force | Out-Null; `
Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2; `
Install-Module SitecoreInstallFramework -RequiredVersion 1.1.0 -Force;
Install-Module SitecoreInstallFramework -RequiredVersion 1.1.0 -Force;

# Install Sitecore
RUN Expand-Archive -Path (Join-Path $env:INSTALL_TEMP '*.zip') -DestinationPath $env:INSTALL_TEMP; `
Expand-Archive -Path (Join-Path $env:INSTALL_TEMP '*Configuration files*.zip') -DestinationPath $env:INSTALL_TEMP; `
$config = Get-Content $env:SIF_CONFIG | Where-Object { $_ -notmatch '^\s*\/\/'} | Out-String | ConvertFrom-Json; `
$config.Tasks.CreatePaths.Params.Exists += '[variable(''Site.DataFolder'')]'; `
$config.Tasks.InstallWDP.Params.Arguments | Add-Member -Name 'Skip' -Value @(@{'ObjectName' = 'dbDacFx'}, @{'ObjectName' = 'dbFullSql'}) -MemberType NoteProperty; `
$config.Variables.'Site.PhysicalPath' = $env:SITEPATH; `
$config.Variables.'Site.DataFolder' = $env:DATAPATH; `
ConvertTo-Json $config -Depth 50 | Set-Content -Path $env:SIF_CONFIG; `
Remove-Website -Name 'Default Web Site'; `
Install-SitecoreConfiguration -Path $env:SIF_CONFIG `
Expand All @@ -53,21 +56,31 @@ RUN Expand-Archive -Path (Join-Path $env:INSTALL_TEMP '*.zip') -DestinationPath
-SolrCorePrefix $env:SITENAME `
-Skip "RemoveDefaultBinding", "CreateBindingsWithThumprint", "CreateHostHeader", "CreateBindingsWithDevelopmentThumprint", "StartAppPool", "StartWebsite", "UpdateSolrSchema"; `
Remove-Item -Path 'C:\\*.log'; `
Remove-Item -Path ('{0}\\App_Data\\logs' -f $env:SITEPATH) -Force -Recurse; `
Copy-Item -Path (Join-Path $env:INSTALL_TEMP '\\Sitecore') -Destination 'C:/' -Recurse -Force; `
$iisPath = ('IIS:\Sites\{0}' -f $env:SITENAME); `
Clear-WebConfiguration -PSPath $iisPath -Filter '/system.webserver/rewrite/rules/rule'; `
Set-WebConfiguration -PSPath $iisPath -Filter '/system.web/customErrors/@mode' -Value 'Off'; `
Add-WebConfigurationProperty -PSPath $iisPath -Filter '/system.webServer/rewrite/outboundRules' -Name '.' -Value @{name = 'MakeLocationHeaderRelative' ; preCondition = 'IsSitecoreAbsoluteRedirect'; match = @{serverVariable = 'RESPONSE_LOCATION'; pattern = '(https?://[^:/]+):?([0-9]+)?(.*)'}; action = @{type = 'Rewrite'; value = '{R:3}'}}; `
Add-WebConfigurationProperty -PSPath $iisPath -Filter '/system.webServer/rewrite/outboundRules/preConditions' -Name '.' -Value @{name = 'IsSitecoreAbsoluteRedirect'}; `
Add-WebConfigurationProperty -PSPath $iisPath -Filter 'system.webServer/rewrite/outboundRules/preConditions/preCondition[@name=''IsSitecoreAbsoluteRedirect'']' -Name '.' -Value @{input = '{RESPONSE_LOCATION}'; pattern = '(https?://[^:/]+):?([0-9]+)?/sitecore/(.*)'}; `
Add-WebConfigurationProperty -PSPath $iisPath -Filter 'system.webServer/rewrite/outboundRules/preConditions/preCondition[@name=''IsSitecoreAbsoluteRedirect'']' -Name '.' -Value @{input = '{RESPONSE_STATUS}'; pattern = '3[0-9][0-9]'}
Add-WebConfigurationProperty -PSPath $iisPath -Filter 'system.webServer/rewrite/outboundRules/preConditions/preCondition[@name=''IsSitecoreAbsoluteRedirect'']' -Name '.' -Value @{input = '{RESPONSE_STATUS}'; pattern = '3[0-9][0-9]'}; `
$xml = New-Object XML; `
$xml.Load(('{0}\app_config\include\examples\DataFolder.config.example' -f $env:SITEPATH)); `
$nsm = New-Object Xml.XmlNamespaceManager($xml.NameTable); `
$nsm.AddNamespace('patch', 'http://www.sitecore.net/xmlconfig/'); `
$element = $xml.SelectSingleNode('//sc.variable[@name=''dataFolder'']/patch:attribute[@name=''value'']', $nsm); `
$element.InnerText=$env:DATAPATH; `
$xml.Save(('{0}\app_config\include\DataFolder.config' -f $env:SITEPATH));


# Cleanup, post installation tweaks and start site
RUN Start-Process msiexec.exe -ArgumentList '/x', $env:WEBDEPLOY_MSI, '/quiet', '/norestart' -NoNewWindow -Wait; `
Uninstall-Module SitecoreInstallFramework -Force; `
Remove-Item -Path $env:INSTALL_TEMP -Force -Recurse; `
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord; `
setx /M PATH $($env:PATH + ';C:\Sitecore\Scripts'); `
Start-WebAppPool -Name $env:SITENAME; `
Start-Website -Name $env:SITENAME
Start-Website -Name $env:SITENAME; `
Remove-Item -Path $env:INSTALL_TEMP -Force -Recurse; `
Remove-Item -Path $env:DATAPATH -Force -Recurse;

VOLUME ${DATAPATH}

0 comments on commit 5ef1b3a

Please sign in to comment.