forked from Sitecore/docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
72 lines (60 loc) · 4.76 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
62
63
64
65
66
67
68
69
70
71
72
# escape=`
ARG BASE_IMAGE
ARG ASSETS_IMAGE
ARG CERTIFICATES_IMAGE
FROM $ASSETS_IMAGE as assets
FROM $CERTIFICATES_IMAGE as certificates
FROM $BASE_IMAGE as build
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
ARG ASSETS_USE_WDP_CONNECT_CORE
ARG ASSETS_USE_WDP_ENGINE_CONNECT
ARG ASSETS_USE_WDP_MA
ARG ASSETS_USE_WDP_XPROFILES
ARG ASSETS_USE_WDP_XANALYTICS
ARG SC_ROLE_CONFIG_DIRECTORY
COPY --from=assets ["${ASSETS_USE_WDP_CONNECT_CORE}", "C:\\temp\\packages\\"]
COPY --from=assets ["${ASSETS_USE_WDP_ENGINE_CONNECT}", "C:\\temp\\packages\\"]
COPY --from=assets ["${ASSETS_USE_WDP_MA}", "C:\\temp\\packages\\"]
COPY --from=assets ["${ASSETS_USE_WDP_XPROFILES}", "C:\\temp\\packages\\"]
COPY --from=assets ["${ASSETS_USE_WDP_XANALYTICS}", "C:\\temp\\packages\\"]
# expand selected wdp into installation directory
RUN Get-ChildItem 'C:\\temp\\packages\\*.zip' | Expand-Archive -DestinationPath 'C:\\temp' -Force ; `
Copy-Item -Path 'C:\\temp\\Content\\Website\\*' -Destination 'C:\\inetpub\\wwwroot' -Recurse -Force;
# copy tools, certificates and transforms
COPY --from=assets ["C:\\install\\tools\\", "C:\\inetpub\\wwwroot\\temp\\install\\tools\\"]
COPY --from=certificates ["C:\\certificates\\", "C:\\inetpub\\wwwroot\\temp\\install\\certificates\\"]
COPY ${SC_ROLE_CONFIG_DIRECTORY} C:\\inetpub\\wwwroot\\
# find transform files, replace variables and do transformation
RUN & 'C:\\inetpub\\wwwroot\\temp\\install\\tools\\scripts\\Invoke-XdtTransform.ps1' -Path 'C:\\inetpub\\wwwroot\\Web.config' `
-XdtPath 'C:\\inetpub\\wwwroot\\MergeFiles\\Sitecore.Commerce.Engine.Connectors.Merge.Config' `
-XdtDllPath 'C:\\inetpub\\wwwroot\\temp\\install\\tools\\bin\\Microsoft.Web.XmlTransform.dll'; `
$env:COMMERCE_CONFIG_PATH = 'C:\\inetpub\\wwwroot\\App_Config\\Include\\Y.Commerce.Engine\\'; `
mv (Join-Path $env:COMMERCE_CONFIG_PATH 'Sitecore.Commerce.Engine.DataProvider.config.disabled') `
(Join-Path $env:COMMERCE_CONFIG_PATH 'Sitecore.Commerce.Engine.DataProvider.config'); `
mv (Join-Path $env:COMMERCE_CONFIG_PATH 'Sitecore.Commerce.Engine.Connectors.Index.Common.config.disabled') `
(Join-Path $env:COMMERCE_CONFIG_PATH 'Sitecore.Commerce.Engine.Connectors.Index.Common.config'); `
mv (Join-Path $env:COMMERCE_CONFIG_PATH 'Sitecore.Commerce.Engine.Connectors.Index.Solr.config.disabled') `
(Join-Path $env:COMMERCE_CONFIG_PATH 'Sitecore.Commerce.Engine.Connectors.Index.Solr.config'); `
$env:COMMERCE_CLIENT_CERT_THUMBPRINT = (Get-Content -Path 'C:\\inetpub\\wwwroot\\temp\\install\\certificates\\commerce-client.thumbprint' | Out-String).Trim(); `
$xdts = [System.Collections.ArrayList]@(); `
$xdts.AddRange(@(Get-ChildItem -Path 'C:\\inetpub\\wwwroot\\App_Config\\Include\\Y.Commerce.Engine\\*.config.xdt' -Recurse)); `
$xdts | ForEach-Object { (Get-Content -Path $_.FullName).Replace('${commerce_client_certificate_thumbprint}', $env:COMMERCE_CLIENT_CERT_THUMBPRINT) | Out-File -FilePath $_.FullName -Encoding utf8; }; `
$xdts | ForEach-Object { & 'C:\\inetpub\\wwwroot\\temp\\install\\tools\\scripts\\Invoke-XdtTransform.ps1' -Path $_.FullName.Replace('.xdt', '') -XdtPath $_.FullName -XdtDllPath 'C:\\inetpub\\wwwroot\\temp\\install\\tools\\bin\\Microsoft.Web.XmlTransform.dll'; }; `
$xdts | ForEach-Object { Remove-Item -Path $_.FullName; };
FROM $BASE_IMAGE
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
COPY --from=build ["C:\\inetpub\\wwwroot\\", "C:\\inetpub\\wwwroot\\"]
RUN $env:INSTALL_TEMP = 'C:\\inetpub\\wwwroot\\temp\\install'; `
$env:IIS_SITE_NAME = 'Default Web Site'; `
$password = ConvertTo-SecureString -String (Get-Content -Path (Join-Path $env:INSTALL_TEMP '\\certificates\\password')) -Force -AsPlainText; `
Import-PfxCertificate -FilePath (Join-Path $env:INSTALL_TEMP '\\certificates\\commerce-client.pfx') -CertStoreLocation 'cert:\localmachine\my' -Password $password | Out-Null; `
# configure SSL binding because Commerce Engine requires HTTPS (see Sitecore ticket #542018)
Import-Module WebAdministration; `
$xcCert = Import-PfxCertificate -FilePath (Join-Path $env:INSTALL_TEMP '\\certificates\\xc.pfx') -CertStoreLocation 'cert:\localmachine\my' -Password $password; `
New-WebBinding -Name $env:IIS_SITE_NAME -IPAddress '*' -Port '443' -Protocol "https" -HostHeader '*'; `
$binding = Get-WebBinding -Name $env:IIS_SITE_NAME -Protocol "https"; `
$binding.AddSslCertificate($xcCert.GetCertHashString(), 'my'); `
# configure SSL flags
Set-WebConfigurationProperty -PSPath 'machine/webroot/apphost' -Filter 'system.webServer/security/access' -Name 'sslFlags' -Value 'SslNegotiateCert'; `
# delete temporary files
Remove-Item -Path $env:INSTALL_TEMP -Force -Recurse;