-
Notifications
You must be signed in to change notification settings - Fork 213
Description
At the moment variant images (e.g sitecore-xm-jss, sitecore-xm-sxa-jss, etc) use multi-stage build approach to decrease the amount of layers. Most of the work is done in a build stage, and the resulting 2-nd stage images are just copying the results to wwwroot:
COPY --from=build ["C:\\inetpub\\wwwroot\\", "C:\\inetpub\\wwwroot\\"]
On the first glance this looks good, but...
The problem
The COPY command actually increases the resulting image size by the size of wwwroot. Since variant images are based on each other (e.g sitecore-xm-sxa-jss is based on sitecore-xm-sxa), such layering increases the total image size on approximately ~400MB multiplied by number of layers. So sitecore-xm-sxa-jss adds ~800MB to the image size.
Proposed solution
Instead of copying the whole wwwroot directory, we need to copy only changed files. For example, when JSS is installed in the sitecore-xm-jss image we need to copy only contents of the JSS package (and make sure transformations are done on a web.config):
- Unpack the JSS package to
c:\temp\wwwroot - Copy
web.configfromBASE_IMAGEtoc:\temp\wwwroot - Run XDT transforms
- In the 2-nd stage image copy
c:\temp\wwwroottoc:\inetpub\wwwroot
If you agree with the approach I can submit a PR ;)