This is a copy of my post originally placed here to keep all things in one place.
There are many articles and quite a significant amount of documentation about Sitecore Docker Asset images. And there are discussed the complex things. But I haven’t seen a basic explanation, of what it is and what it is not. Let’s reveal the magic!
An asset image is an image that contains files that you want to use in other images. Website files are included as files. Sitecore items are included as files. Sitecore Solr cores are included as files. Service scripts are included as files. And asset image doesn’t do anything by itself. It is just a set of files.
Actually, you may achieve exactly the same goals by packaging everything to some archive, uploading it somewhere, and using it during the build or your images. But having an “asset image” is much easier and more containers-way to achieve what we need.
And you may build Sitecore Docker Asset Image in different ways. Matters the only one thing: it should contain files that you will need to use in your other images.
Docker Asset Image Structure
Internal Docker asset image structure is a convention. You may follow it, or you can ignore it. You should understand that you may put files inside your Docker image asset in any folders that you like. You can completely ignore conventions, everything still may work for you. But, it is only much better to place files in the same locations that Sitecore uses. It will make your image to be similar to other images. And usage of your image will be intuitive for other developers. They will expect files in some locations and you will justify their expectation.
You put files required on Content Management (CM) required to be on that role to module\cm\content
. You put files required on Content Delivery (CD) required to be on that role to module\cd\content
. If you have any other roles, you follow the same pattern. If you have any Solr cores, you put them under module\solr
. You put any scripts that you want to execute into module\tools
. You put Sitecore items in .dacpac
format under module\db
. And you put Sitecore items in item-as-resources under module\[role]\App_Data\items\[database name]\*.dat
Sitecore Content Items
There are 2 options for how you put items as files into the Sitecore asset image. The first is Data Tier AppliCation Package .dacpac
. And the second ”items as resources” format .dat
. You don’t need to place your items in 2 formats. You need to select what works better for us.
In theory, you can move your items into the Sitecore images using a different approach: .bacpac
, running custom SQL queries, using serialization. etc. But for these approaches, you will need to do additional actions by yourself.
Using Asset Image
Files from your asset image don’t magically are used in other images. For each file(group of files) you need to perform some actions. You need to copy files that are part of your website. You need to copy “items as resources” to the proper location of your website. You need to copy .dacpac
files to your MS SQL image and deploy them using DeployDatabases.ps1
script that comes with the Sitecore Tooling image. You need to copy Solr cores to your Solr image.
Conclusion
I hope you get a better understanding of Sitecore Asset Images. It is just a set of files. I hope this thought will make the creation of your own images and other images much more intuitive.
No comments:
Post a Comment