In the previous article, we were able to launch an instance of XM1. In this article, we will configure additional settings to make the Sitecore Experience Accelerator module available to the container, which is necessary for adding Next.js projects.
Docker configuration, image modification
First, add the following settings to install the module. First, set the following three items in the .env file.
SITECORE_MODULE_REGISTRY=scr.sitecore.com/sxp/modules/
SPE_VERSION=6.4-1809
SXA_VERSION=10.3-1809
Then for docker-compose.override.yml, pass the following image values to mssql-init , solr-init , cd and cm to install the SXA and SPE modules (the actual line to add will be under args) The following image values are required
ssql-init:
build:
args:
SPE_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-spe-assets:${SPE_VERSION}
solr-init:
build:
args:
SXA_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-sxa-xm1-assets:${SXA_VERSION}
cd:
build:
args:
SXA_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-sxa-xm1-assets:${SXA_VERSION}
cm:
build:
args:
SPE_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-spe-assets:${SPE_VERSION}
SXA_IMAGE: ${SITECORE_MODULE_REGISTRY}sitecore-sxa-xm1-assets:${SXA_VERSION}
This will make the necessary files available when building each Dockerfile. First, add the following to the dockerfile in cd.
ARG SXA_IMAGE
FROM ${SXA_IMAGE} as sxa
# Add SXA module
COPY --from=sxa \module\cd\content .\
COPY --from=sxa \module\tools \module\tools
RUN C:\module\tools\Initialize-Content.ps1 -TargetPath .\; `
Remove-Item -Path C:\module -Recurse -Force;
Then edit the cm dockerfile.
ARG SXA_IMAGE
ARG SPE_IMAGE
FROM ${SPE_IMAGE} as spe
FROM ${SXA_IMAGE} as sxa
# Add SPE module
COPY --from=spe \module\cm\content .\
# Add SXA module
COPY --from=sxa \module\cm\content .\
COPY --from=sxa \module\tools \module\tools
RUN C:\module\tools\Initialize-Content.ps1 -TargetPath .\; `
Remove-Item -Path C:\module -Recurse -Force;
The next step is to work on the dockerfile for mssql-init.
ARG SPE_IMAGE
FROM ${SPE_IMAGE} as spe
# copy pse
COPY --from=spe C:\module\db C:\resources\spe
Finally, update the solr-init dockerfile.
ARG SXA_IMAGE
FROM ${SXA_IMAGE} as sxa
# Add SXA module
COPY --from=sxa C:\module\solr\cores-sxa.json C:\data\cores-sxa.json
You are now ready to install the module.
Startup
First, delete the previously started data once, using the clean.ps1 file in the docker folder. If the data has already been started, please drop it once.
cd docker.\clean.ps1cd ..
This time, we only need to build and start the image again, so execute the following command to start the container again.
docker-compose builddocker-compose up -d
After the container is started, access the Sitecore server that is running. After logging in, confirm that you can create tenants in the Content Editor.
Please check for sxa entries against the Solr index as well.
If the index is working properly, rebuild the index once to complete this preparation.
Summary
Now you can use SXA in Sitecore XM environment. In the next article, we will create a project for Sitecore's Next.js so that it can be integrated with Sitecore.