Skip to content

Commit 60c2e07

Browse files
author
Kamruz Jaman
committed
Updated script to make TAG optional
1 parent e949b8c commit 60c2e07

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

Create-SitecoreModule-DockerAssetImage.ps1

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,6 @@ if (!$ModulePackageName) {
4747
Break
4848
}
4949

50-
if (!$Tag) {
51-
Write-Host "================================================================================================================================="
52-
Write-Host "`n"
53-
Write-Host "ERROR - Make sure you pass in the -Tag parameter. e.g. .\\Create-SitecoreModule-DockerAssetImage.ps1 -Tag 'DOCKER IMAGE TAG'" -ForegroundColor Red
54-
Write-Host "`n"
55-
Write-Host "================================================================================================================================="
56-
Break
57-
}
58-
5950
Write-Host "================================================================================================================================="
6051
Write-Host "`n"
6152
Write-Host "START - [Sitecore Azure Toolkit download]"
@@ -217,19 +208,21 @@ Write-Host "`n"
217208

218209
tree $moduleDirectory /f /a
219210

220-
Write-Host "========================================================================================================================"
221-
Write-Host "`n"
222-
Write-Host "START - [Building Docker Image] -" $Tag.ToLower()
223-
Write-Host "`n"
211+
if ($Tag) {
212+
Write-Host "========================================================================================================================"
213+
Write-Host "`n"
214+
Write-Host "START - [Building Docker Image] -" $Tag.ToLower()
215+
Write-Host "`n"
224216

225-
Set-Location -Path $moduleDirectory
226-
docker build --tag $Tag.ToLower() .
217+
Set-Location -Path $moduleDirectory
218+
docker build --tag $Tag.ToLower() .
227219

228-
Write-Host "=================================================================================================================================="
229-
Write-Host "`n"
230-
Write-Host "SUCCESS - Created local image" $Tag.ToLower() -ForegroundColor Green
231-
Write-Host "Don't forget to push the image to the Container Registry or Docker Hub." -ForegroundColor Yellow
232-
Write-Host "`n"
220+
Write-Host "=================================================================================================================================="
221+
Write-Host "`n"
222+
Write-Host "SUCCESS - Created local image" $Tag.ToLower() -ForegroundColor Green
223+
Write-Host "Don't forget to push the image to the Container Registry or Docker Hub." -ForegroundColor Yellow
224+
Write-Host "`n"
225+
}
233226

234227
Write-Host "`n"
235228
Write-Host "=================================================================================================================================="

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ This repository contains a script to handle the auto creation of a Docker Asset
88
```powershell
99
.\Create-SitecoreModule-DockerAssetImage.ps1 -ModulePackageName "Sitecore.PowerShell.Extensions-6.3.zip" -Tag "sitecorepowershell/sitecore-powershell-extensions:6.3-1809" -GenerateCdContentDirectory
1010
```
11+
12+
Or use the shorthand aliases:
13+
```powershell
14+
.\Create-SitecoreModule-DockerAssetImage.ps1 -M "Sitecore.PowerShell.Extensions-6.3.zip" -T "sitecorepowershell/sitecore-powershell-extensions:6.3-1809" -G
15+
```
16+
1117
- The folder name is generated based on the ModulePackageName provided while invoking the script and appends the current datetime stamp in `ModulePackageName_yyyyMMdd_HHmmss` format
1218
- Run the docker file under Module folder to generate the image. The script only extracts it for CM role. For other roles, you have to manually create role specific docker files
1319
- Once the image is generated, push it to your container registry to share it with other devs in your team or devops for AKS deployment

0 commit comments

Comments
 (0)