- Get link
- X
- Other Apps
Posted by
Sudheer Kumar Suggu
on
- Get link
- X
- Other Apps
Overview
The detailed step by step explanation about the creation of Docker image from Sitecore package as these images serve as templates for creating Sitecore containers. So this is very important step in creating our custom images for our container implementation.
Convert package to scwdp file from Sitecore package
- Download the Sitecore Azure Toolkit from dev.sitecore.net
- Create a new folder somewhere on your drive (e.g. C:\WDP)
- Unzip the toolkit and copy the contents into C:\WDP
- Put your Sitecore module installation package (.zip) in C:\WDP and it is highlighted.
- Run Powershell as an administrator in the WDP folder and run the following commands:
Import-Module .\tools\Sitecore.Cloud.Cmdlets.psm1
Import-Module .\tools\Sitecore.Cloud.Cmdlets.dll
ConvertTo-SCModuleWebDeployPackage -Path "c:\wdp\{Name-of-your-sitecore-package}.zip" -Destination "C:\WDP"
- Refer below snippet for example:
That’s all you need for your git release!
Creating a Docker Asset
- Create a new folder, e.g. C:\ModuleAssets
- Create the following folder structure:
- C:\ModuleAssets\module\cm\content
- C:\ModuleAssets\module\db
- Unzip your scwdp.zip and after unzip you can see the files as shown below.
- Copy all dacpac files (in the root of the zip folder) into C:\ModuleAssets\module\db. Make sure to rename them with Sitecore.<databaseName>.dacpac format (e.g. Sitecore.master.dacpac, Sitecore.core.dacpac)
- Copy the contents of {Unzipped scwdp folder}\Content\Website to C:\ModuleAssets\module\cm\content
- Some of the images might to be created as per below snap. Here under content folder copy the content from {Unzipped scwdp folder}\Content\Website path and all these to C:\ModuleAssets\module\content based on docker file for that instance (as per Note).
The next step is to create our asset image using the ModuleAssets folder we just set up.
Open Docker Hub and log in (or create an account and use them for login)
Login your Docker desktop and it will automatically authenticated with the credentials.
Create a repository for your asset image (I recommend naming it as closely to your module as possible)
Create a new DockerFile in C:\ModuleAssets (create an empty file named DockerFile with no extension)
Copy this into the new DockerFile:
FROM mcr.microsoft.com/windows/nanoserver:1809 AS build
# Copy assets into the image, keeping the folder structure
COPY \ .\
Build the docker image
Navigate to C:\ModuleAssets in Powershell and run the following command (note that the version is whatever you decide it is). Don’t leave out the period at the end!
Run follow commands this helps to authenticate with docker hub
docker login -u "username" -p password docker.io
Run this command, to build the docker asset
docker build --tag {your docker username}/{your docker repo name}:{your module version} .
Example for 2nd command:
docker build --tag dockerrepo/claytablet-for-sitecore:6.3.3-10.2-1809 .
Run this command, to push the docker asset into docker repository
docker push {your docker username}/{your docker repo name}:{your module version}
Example for 3rd command:
docker image push dockerrepo/claytablet-for-sitecore:6.3.3-10.2-1809
Once these commands are executed successfully, you can see the latest version of this asset in present in the docker hub repository.
Happy Dockering with Sitecore!!
Comments
Post a Comment
Please do not enter any spam link in the comment box