forked from sitecoreops/sitecore-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
61 lines (55 loc) · 4.43 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2019 as builder
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
COPY . /install/
# Expand zips, prepare SIF config and WDP package
RUN $env:SITENAME = 'sc'; `
$env:INSTALL_TEMP = 'C:\\install'; `
$env:SIF_CONFIG = 'sitecore-XM1-cm.json'; `
$env:SIF_PACKAGE = 'Sitecore*_cm.scwdp.zip'; `
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 (Join-Path $env:INSTALL_TEMP $env:SIF_CONFIG) | ConvertFrom-Json; `
$config.Tasks.InstallWDP.Params.Arguments | Add-Member -Name 'Skip' -Value @(@{'ObjectName' = 'dbDacFx'}, @{'ObjectName' = 'dbFullSql'}) -MemberType NoteProperty; `
$config.Variables.'Site.PhysicalPath' = 'C:\inetpub\{0}' -f $env:SITENAME; `
ConvertTo-Json $config -Depth 50 | Set-Content -Path (Join-Path $env:INSTALL_TEMP $env:SIF_CONFIG); `
Rename-Item -Path (Resolve-Path (Join-Path $env:INSTALL_TEMP $env:SIF_CONFIG)).Path -NewName 'sitecore.json'; `
Rename-Item -Path (Resolve-Path (Join-Path $env:INSTALL_TEMP $env:SIF_PACKAGE)).Path -NewName 'sitecore.zip';
# Runtime
FROM sitecore-base:9.1.001564-windowsservercore-ltsc2019
COPY --from=builder ["/install/sitecore.zip", "/install/sitecore.json", "/install/license.xml", "/install/"]
COPY --from=builder ["/install/Sitecore", "/Sitecore"]
# Install Sitecore, apply tweaks, cleanup and start site
RUN $env:SITENAME = 'sc'; `
$env:INSTALL_TEMP = 'C:\\install'; `
$env:SQL_ADMIN_USER = 'sa'; `
$env:SQL_ADMIN_PASSWORD = 'HASH-epsom-sunset-cost7!'; `
Install-SitecoreConfiguration -Path (Join-Path $env:INSTALL_TEMP '\\sitecore.json') -Package (Join-Path $env:INSTALL_TEMP '\\sitecore.zip') `
-LicenseFile (Join-Path $env:INSTALL_TEMP '\\license.xml') `
-Sitename $env:SITENAME `
-SitecoreAdminPassword "b" `
-SitecoreIdentityAuthority "https://127.0.0.1" `
-SitecoreIdentitySecret $env:SQL_ADMIN_PASSWORD `
-SolrUrl "http://solr:8983/solr" `
-SolrCorePrefix $env:SITENAME `
-SqlServer "sql" `
-SqlDbPrefix $env:SITENAME `
-SqlAdminUser $env:SQL_ADMIN_USER -SqlAdminPassword $env:SQL_ADMIN_PASSWORD `
-SqlSecurityUser $env:SQL_ADMIN_USER -SqlSecurityPassword $env:SQL_ADMIN_PASSWORD `
-SqlCoreUser $env:SQL_ADMIN_USER -SqlCorePassword $env:SQL_ADMIN_PASSWORD `
-SqlMasterUser $env:SQL_ADMIN_USER -SqlMasterPassword $env:SQL_ADMIN_PASSWORD `
-SqlWebUser $env:SQL_ADMIN_USER -SqlWebPassword $env:SQL_ADMIN_PASSWORD `
-SqlFormsUser $env:SQL_ADMIN_USER -SqlFormsPassword $env:SQL_ADMIN_PASSWORD `
-Skip "RemoveDefaultBinding", "CreateBindingsWithThumbprint", "CreateHostHeader", "CreateBindingsWithDevelopmentThumbprint", "StartAppPool", "StartWebsite", "UpdateSolrSchema", "DisplayPassword"; `
$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]'}; `
Remove-Item -Path 'C:\\*.log'; `
Remove-Item -Path ('C:\\inetpub\\{0}\\App_Data\\logs' -f $env:SITENAME) -Force -Recurse; `
Remove-Item -Path $env:INSTALL_TEMP -Force -Recurse; `
Start-WebAppPool -Name $env:SITENAME; `
Start-Website -Name $env:SITENAME