My new blog present here.

Featured Post

Insights into Sitecore Search: A Definitive Introduction

A key component of digital experience management is effective information retrieval. A simplified approach is required for websites, applications, and platforms containing a lot of material so that consumers can easily get the data they require. This need is met by Sitecore, a well-known name in the field of digital experience platforms (DXPs), which provides powerful and comprehensive search functionality. We will travel into the realm of Sitecore Search in this article, learning about its capabilities, architecture , and the enormous value it offers both developers and end users. Introduction to Sitecore Search    A headless content discovery platform powered by AI , Sitecore Search enables you to build predictive and custom search experiences across various content sources. To extract and ...

Mind the order of instructions in a Dockerfile for Sitecore Containers

The Sitecore provides flexibility and different deployment for Sitecore development, and one of the modern ways is Docker Container based Sitecore development and deployment to Kubernetes.

Sitecore provides full support for deploying solutions in a containerized environment of your choice and knowledge articles.

There are some cases which are project specific and may not be covered in Sitecore Official Documentations, and in this blog, I will be sharing one of the use case.

In Sitecore Experience Platform, there are flavours which can be utilized by individuals to deploy the application as per their need like Sitecore XP Single/Sitecore XP Scaled/Sitecore XM Scaled , and according to these topologies sometime you have to deploy files into Specific Sitecore Roles.

                                                                      Credit: Sitecore

The deployment of files mostly depends upon the way you have designed/structured your project code base. Some will follow three layered architecture/ Sitecore helix principles / Sitecore Helix Project Solution Template. Based on your requirements, you will write a logic into a specific layer. In my case, I have some configuration which needs to be deployed into a specific Sitecore Role in Containers from one image to a different image and different role. The Visual Solution structure is like:


├── src                                                  # Main Source Folder
        ├── Environment                          # Environment related code base
                ├── platform                         # Source files which deployed to CM and CD
                ├── sitecore                          # Source files which deployed to CM
                ├── xdbcollection                 # Source files which deployed to xdbcollection
├── docker                                            # Source files for docker build
         ├── build                                     # Docker build related files
                ├── cd                                  # CD Build folder
                ├── cm                                 # CM Build folder
                ├── xdbcollection                # xDBCollection Build folder
                ├── xdbsearch                     # xDBSearch Build folder
├── docker-compose.override.yml     # Custom docker-compose file
├── Dockerfile                                    # Main Docker build file


For example, some configuration file which also needs to be xDBSearch which is present in xdbcollection source folder and deployed to xdbcollection role only via xdbcollection deployment.

I have tried to explain the flow of Main Docker Build file, which will build required artifacts and copy to specific environment folder in Solution Image, which is later used to build different Sitecore Containers:


Every Sitecore role has their own Dockerfile which will be used to deploy required artifacts on top of base/parent Sitecore Role image.

Our requirement is to deploy xDBCollection related artifacts into xDBSearch Role. The default xDBCollection and xDBSearch docker file:

Now, we have to deploy models from xConnect folder from Solution Image into xDBSearch. In this case, we have to update the xDBSearch Dockerfile present at \docker\build\xdbsearch\Dockerfile: 


If you execute the docker-compose command, then you will get the following error :
COPY --from=solution /artifacts/xconnect/App_Data/Models/ ./App_Data/Models/ invalid from flag value solution: pull access denied for solution, repository does not exist or may require 'docker login': denied: requested access to the resource is denied ERROR: Service 'xdbsearch' failed to build : Build failed

The above error was encountered due to the wrong order of image used in Sitecore xDBSearch Dockerfile, e.g. we are trying to access the Solution image after the Parent image. 

To resolve the error, we have to provide the correct order of images which we wanted to use:

By considering the correct order, you can deploy any file from any image into any Sitecore Roles.

Credit/References:


Pingback:

Building custom Sitecore images Copying Files To And From Docker Containers - Baeldung Understanding Docker Volumes
Sitecore/docker-examples: Companion code for the Containers in Sitecore development Sitecore Docker images repository
Installing / Running the Examples | Sitecore Helix Examples Best practices for writing Dockerfiles | Docker Documentation Docker: adding a file from a parent directory - Stack Overflow
Optimizing Your Dockerfile. The ordering of instructions in a… | by Erik Kristensen | Medium Dockerfile Cheat Sheet - Kapeli A tutorial on building a Docker image for Sitecore
sitecore kafka Sitecore Content Migration Using Sitecore Express Migration Tool Sitecore xDB Migration Using Sitecore xDB Data Migration Tool
How to use Sitecore SwitchOnRebuildSolrSearchIndex on Solr slave Indexes which are replicated from Master Index
Start using Sitecore GraphQL API Sitecore Helix Recommendation and Conventions - Helix 2.0 What’s new in Sitecore 10
Analysis for Sitecore Experience Accelerator (SXA) based website implementation Secure Sitecore JSS Site Sitecore Experience Accelerator (SXA)
Sitecore Graphql tutorial Sitecore Performance Tuning Sitecore GraphQl Examples
What is SXA Page Design? Sitecore Installation and Upgrade Guides Speed Up Sitecore Upgrade with PackageReference
Upgrade to Sitecore 9 Sitecore Version 10 - Sitecore Upgrade Process Sitecore 10 Upgrade
sitecore docker sitecore docker images sitecore docker examples
github sitecore docker images sitecore docker registry sitecore docker getting started
sitecore docker github sitecore docker cheat sheet sitecore docker tools
sitecore docker compose sitecore docker for traefik container is unhealthy sitecore with docker
sitecore docker access to the path is denied sitecore on docker sitecore and docker
sitecore docker container sitecore docker azure sitecore-docker-tools-assets
sitecore 10 docker architecture sitecore docker containers sitecore docker container registry
sitecore docker custom images sitecore docker container unhealthy sitecore docker documentation
Sitecore JavaScript Rendering SDK (JSS) for Next.js sitecore headless architecture sitecore jss docker
sitecore disconnected mode sitecore first jss sitecore jss headless
sitecore jss helix sitecore jss nextjs sitecore nodejs
sitecore nextjs sitecore ssr next js sitemap
sitecore cancel publish next js static site regeneration next.js or gatsby
Start using Sitecore GraphQL API Sitecore Helix Recommendation and Conventions - Helix 2.0 What’s new in Sitecore 10
Analysis for Sitecore Experience Accelerator (SXA) based website implementation Secure Sitecore JSS Site Sitecore Experience Accelerator (SXA)
Sitecore Graphql tutorial Sitecore Performance Tuning Sitecore GraphQl Examples
What is SXA Page Design? Sitecore Installation and Upgrade Guides Sitecore Upgrade Services

Comments

Unknown said…
Very Useful. Thanks Amit sir.

Popular posts from this blog

Sitecore GraphQL Queries

Sitecore Experience Manager Cloud (XM Cloud) Building blocks

Configuring Sitecore Next.js Headless SXA Multisite App in a Sitecore Container