Build Coveo for Sitecore Docker image variants

I’ve been developing with Sitecore on Docker for almost a year now… WOW time flies when you are having fun! While the Sitecore Docker image repo is awesome and provides a range of Sitecore variants, you will probably discover the need for additional image variants, depending on your project. As you often require additional modules to be installed as your base Sitecore install, like the Coveo for Sitecore module! Rather than your team having to install this module manually when they docker compose up, it would much quicker and easier they have a variant image they can use with it already installed. In this post, I will show you how to can build a docker image variant for Coveo for Sitecore v5 using the Sitecore 9.3 images.

1. Covert Coveo for Sitecore Module to WDP

First you are going to need the Sitecore Azure Toolkit. If you have not used the toolkit before you will need ensure you have the following:

  • Powershell 4.x or newer
  • MSDeploy
  • SQL Server
  • Microsoft SQL Server Data-Tier Application Framework (DacFX) for SQL server 2012 or later.
  1. Import methods into powershell
    • PS> Import-Module “[AzureToolkitFolderPath]\tools\Sitecore.Cloud.Cmdlets.dll” -Verbose
  2. Convert the input package using the ConvertTo-SCModuleWebDeployPackage method.
    • PS> ConvertTo-SCModuleWebDeployPackage -Path “” -Destination “CoveoWdpPath” -force -verbose

Hugo Santos has written an easy how to guide on this if you need more info on this.

2. Update Sitecore Assets Image

The Sitecore assets image is a resource image. It contains Sitecore WDP files for Sitecore, Sitecore modules for the variants and various other tools and resources. It is used when building the Sitecore images. These resources get copied from the asset image into the images you are building as required and as defined in the images build.json file.

  • Update the build.json file and include the name of the Coveo wdp file created in step 1.
  • Copy the generated Coveo wdp file into the packages folder.
  • When the assets image is built your wdp file will get copied into the asset image.

3. Create Coveo variant dockerfile and build.json files for CM & CD

Images are built on the concept of layers you will need to decide which Sitecore image you are going to build on top of for your own variant. This is known as the BASE image in build.json file. The BASE image is the image designated in the FROM directive in the image’s Dockerfile. All subsequent commands are based on this parent image. Essentially you are layering images on top of images. In this example I will use the SPE variant as my base image.

Rather than start with a blank docker file and build.json file i’ll just copy the existing sitecore-spe folder as my starting point and then make necessary modifications.

PS> copy c:\projects\docker-images\windows\9.x.x\sitecore-spe c:\projects\docker-images\windows\9.x.x\sitecore-spe-coveo 

Make the following modifications:

  1. Open the 9.x.x\sitecore-spe-coveo\build.json file and rename all the tag values from sitecore-spe-* to sitecore-spe-coveo.
  2. Change all the build-options BASE_IMAGE values to the spe image for each role standalone and cm.
  3. Change the ASSETS_USE_WDP the Coveo wdp package created in step 1.
  4. Enable the experimental property.

4. Create Coveo Sqldev image

You also need to create a SQLdev image. The Sqldev image will layer database changes contained in the coveo wdp package onto your chosen base sql image databases. If you would like to understand how it performs this may I suggest looking at the Extract-Databases.ps1 and Install-Databases.ps1 located in \windows\9.x.x\sitecore-spe-sqldev.

As we have chosen SPE are our base variant image we will use the Sqldev-spe as our base sql image. Again copy the the Sqldev-spe folder:

PS> copy c:\projects\docker-images\windows\9.x.x\sitecore-spe-sqldev c:\projects\docker-images\windows\9.x.x\sitecore-spe-coveo-sqldev 

Make the following modifications:

  1. Open the 9.x.x\sitecore-spe-coveo-sqldev\build.json file and rename all the tag values from sitecore-spe-sqldev* to sitecore-spe-coveo-sqldev.
  2. Change all the build-options BASE_IMAGE values to the sitecore-[role]-spe-sqldev image for each role.
  3. Change the ASSETS_USE_WDP to Coveo wdp package created in step 1.
  4. Enable the experimental property.

5. Build variant images

You are now ready to build your new Coveo image variants using the buid.ps1. Make sure you enable the IncludeExpermental option this will build images marked as experimental.

ps> .\Build.ps1 -SitecoreUsername <Username> -SitecorePassword <Password> -SitecoreVersion "9.3.0" -Topology "xp" -OSVersion "ltsc2019" -IncludeSpe -SkipExistingImage -IncludeExperimental

6. Tag & Push images to Repo

Remember to tag and push your new images to your shared repo to make them available to your team.

7. Update Docker Compose

Once your variant images are built you just need to update your docker compose file to use your newly built image variants. When you docker compose up locally you will have a vanilla instance of 9.3 and the Coveo module installed. Developers in your team just need to configure their local instance for with their own Coveo trial license details.

8. Clean up Resources

Docker is very conservative when it comes to cleaning up unused resources. You have to explicitly clean these up yourself. So After building your variant images you will find you have several dangling images.

A dangling image is a layer that has no relationship to any tagged images. They no longer serve a purpose and consume disk space. To conserve disk space you should get into the habit of cleaning up these unused resources especially after you build images.

You can easily get a list of the dangling images:

PS> docker images -f dangling=true

You can remove these either using the prune or rmi commands:

PS> rmi -f $(docker images -f “dangling=true” -q)

Useful links

Have fun!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s