@@ -2,80 +2,120 @@ $scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
22
33Write-Host " Current script directory is $scriptPath " - ForegroundColor Yellow
44
5- $pubFolderToDelete = $scriptPath + " \pub"
6- remove-item - path $pubFolderToDelete - Force - Recurse - ErrorAction SilentlyContinue
5+ # *** WebMVC paths ***
6+ $webMVCPath = $scriptPath + " \src\Web\WebMVC"
7+ $webMVCPathToProject = $webMVCPath + " \WebMVC.csproj"
8+ Write-Host " webMVCPathToProject is $webMVCPathToProject " - ForegroundColor Yellow
9+ $webMVCPathToPub = $webMVCPath + " \obj\Docker\publish"
10+ Write-Host " webMVCPathToPub is $webMVCPathToPub " - ForegroundColor Yellow
711
8- # *** WebMVC image ***
9- $webPathToJson = $scriptPath + " \src\Web\WebMVC\project.json"
10- Write-Host " webPathToJson is $webPathToJson " - ForegroundColor Yellow
11- $webPathToPub = $scriptPath + " \pub\webMVC"
12- Write-Host " webPathToPub is $webPathToPub " - ForegroundColor Yellow
1312
14- Write-Host " Restore Dependencies just in case as it is needed to run dotnet publish" - ForegroundColor Blue
15- dotnet restore $webPathToJson
16- dotnet build $webPathToJson
17- dotnet publish $webPathToJson - o $webPathToPub
18-
19- # *** WebSPA image ***
13+ # *** WebSPA paths ***
2014$webSPAPath = $scriptPath + " \src\Web\WebSPA\eShopOnContainers.WebSPA"
21- $webSPAPathToJson = $webSPAPath + " \project.json "
22- Write-Host " webSPAPathToJson is $webSPAPathToJson " - ForegroundColor Yellow
23- $webSPAPathToPub = $scriptPath + " \pub\webSPA "
15+ $webSPAPathToProject = $webSPAPath + " \eShopOnContainers.WebSPA.csproj "
16+ Write-Host " webSPAPathToProject is $webSPAPathToProject " - ForegroundColor Yellow
17+ $webSPAPathToPub = $webSPAPath + " \obj\Docker\publish "
2418Write-Host " webSPAPathToPub is $webSPAPathToPub " - ForegroundColor Yellow
2519
26- Write-Host " Installing npm dependencies"
27- Start-Process - WorkingDirectory $webSPAPath - NoNewWindow - Wait npm i
28-
29- Write-Host " Restore Dependencies just in case as it is needed to run dotnet publish" - ForegroundColor Blue
30- dotnet restore $webSPAPathToJson
31- dotnet build $webSPAPathToJson
32- dotnet publish $webSPAPathToJson - o $webSPAPathToPub
3320
34- # *** identitySvc image ***
35- $identitySvcPathToJson = $scriptPath + " \src\Services\Identity\Identity.API\project.json"
36- Write-Host " identitySvcPathToJson is $identitySvcPathToJson " - ForegroundColor Yellow
37- $identitySvcPathToPub = $scriptPath + " \pub\identity"
21+ # *** IdentitySvc paths ***
22+ $identitySvcPath = $scriptPath + " \src\Services\Identity\Identity.API"
23+ $identitySvcToProject = $identitySvcPath + " \Identity.API.csproj"
24+ Write-Host " identitySvcToProject is $identitySvcToProject " - ForegroundColor Yellow
25+ $identitySvcPathToPub = $identitySvcPath + " \obj\Docker\publish"
3826Write-Host " identitySvcPathToPub is $identitySvcPathToPub " - ForegroundColor Yellow
3927
40- Write-Host " Restore Dependencies just in case as it is needed to run dotnet publish" - ForegroundColor Blue
41- dotnet restore $identitySvcPathToJson
42- dotnet build $identitySvcPathToJson
43- dotnet publish $identitySvcPathToJson - o $identitySvcPathToPub
4428
45- # *** Catalog service image ***
46- $catalogPathToJson = $scriptPath + " \src\Services\Catalog\Catalog.API\project.json"
47- Write-Host " catalogPathToJson is $catalogPathToJson " - ForegroundColor Yellow
48- $catalogPathToPub = $scriptPath + " \pub\catalog"
29+ # *** Catalog paths ***
30+ $catalogPath = $scriptPath + " \src\Services\Catalog\Catalog.API"
31+ $catalogPathToProject = $catalogPath + " \Catalog.API.csproj"
32+ Write-Host " catalogPathToProject is $catalogPathToProject " - ForegroundColor Yellow
33+ $catalogPathToPub = $catalogPath + " \obj\Docker\publish"
4934Write-Host " catalogPathToPub is $catalogPathToPub " - ForegroundColor Yellow
5035
51- Write-Host " Restore Dependencies just in case as it is needed to run dotnet publish" - ForegroundColor Blue
52- dotnet restore $catalogPathToJson
53- dotnet build $catalogPathToJson
54- dotnet publish $catalogPathToJson - o $catalogPathToPub
55-
56- # *** Ordering service image ***
57- $orderingPath = $scriptPath + " \src\Services\Ordering"
58- Write-Host " orderingPath is $orderingPath " - ForegroundColor Yellow
59- $orderingApiPathToJson = $orderingPath + " \Ordering.API\project.json"
60- Write-Host " orderingApiPathToJson is $orderingApiPathToJson " - ForegroundColor Yellow
61- $orderingApiPathToPub = $scriptPath + " \pub\ordering"
62- Write-Host " orderingApiPathToPub is $orderingApiPathToPub " - ForegroundColor Yellow
63-
64- Write-Host " Restore Dependencies just in case as it is needed to run dotnet publish" - ForegroundColor Blue
65- dotnet restore $orderingPath
66- dotnet build $orderingApiPathToJson
67- dotnet publish $orderingApiPathToJson - o $orderingApiPathToPub
68-
69- # *** Basket service image ***
70- $basketPathToJson = $scriptPath + " \src\Services\Basket\Basket.API\project.json"
71- Write-Host " basketPathToJson is $basketPathToJson " - ForegroundColor Yellow
72- $basketPathToPub = $scriptPath + " \pub\basket"
36+
37+ # *** Ordering paths ***
38+ $orderingPath = $scriptPath + " \src\Services\Ordering\Ordering.API"
39+ $orderingPathToProject = $orderingPath + " \Ordering.API.csproj"
40+ Write-Host " orderingPathToProject is $orderingPathToProject " - ForegroundColor Yellow
41+ $orderingPathToPub = $orderingPath + " \obj\Docker\publish"
42+ Write-Host " orderingPathToPub is $orderingPathToPub " - ForegroundColor Yellow
43+
44+ # *** Basket paths ***
45+ $basketPath = $scriptPath + " \src\Services\Basket\Basket.API"
46+ $basketPathToProject = $basketPath + " \Basket.API.csproj"
47+ Write-Host " basketPathToProject is $basketPathToProject " - ForegroundColor Yellow
48+ $basketPathToPub = $basketPath + " \obj\Docker\publish"
7349Write-Host " basketPathToPub is $basketPathToPub " - ForegroundColor Yellow
7450
75- Write-Host " Restore Dependencies just in case as it is needed to run dotnet publish" - ForegroundColor Blue
76- dotnet restore $basketPathToJson
77- dotnet build $basketPathToJson
78- dotnet publish $basketPathToJson - o $basketPathToPub
51+
52+ # #######################################################################################
53+ # Delete old eShop dotnet publish bits
54+ # #######################################################################################
55+ Write-Host " Deleting previous dotnet publish bits from all projects" - ForegroundColor Blue
56+
57+ remove-item - path $WebMVCPathToPub - Force - Recurse - ErrorAction SilentlyContinue
58+ remove-item - path $webSPAPathToPub - Force - Recurse - ErrorAction SilentlyContinue
59+ remove-item - path $identitySvcPathToPub - Force - Recurse - ErrorAction SilentlyContinue
60+ remove-item - path $catalogPathToPub - Force - Recurse - ErrorAction SilentlyContinue
61+ remove-item - path $orderingPathToPub - Force - Recurse - ErrorAction SilentlyContinue
62+ remove-item - path $basketPathToPub - Force - Recurse - ErrorAction SilentlyContinue
63+
64+
65+
66+ # #######################################################################################
67+ # Building DotNet bits
68+ # #######################################################################################
69+
70+ # WebMVC: Build dotnet bits
71+ Write-Host " WebMVC: Restore Dependencies, dotnet build and dotnet publish" - ForegroundColor Blue
72+ dotnet restore $WebMVCPathToProject
73+ dotnet build $WebMVCPathToProject
74+ dotnet publish $WebMVCPathToProject - o $WebMVCPathToPub
75+
76+
77+ # WebSPA: Build dotnet bits
78+ Write-Host " WebSPA: Installing npm dependencies"
79+ # TEMP COMMENT--- Start-Process -WorkingDirectory $webSPAPath -NoNewWindow -Wait npm i
80+
81+ Write-Host " WebSPA: Restore Dependencies, dotnet build and dotnet publish" - ForegroundColor Blue
82+ dotnet restore $webSPAPathToProject
83+ dotnet build $webSPAPathToProject
84+ dotnet publish $webSPAPathToProject - o $webSPAPathToPub
85+
86+
87+ # Identity Service: Build dotnet bits
88+ Write-Host " Identity Service: Restore Dependencies, dotnet build and dotnet publish" - ForegroundColor Blue
89+ dotnet restore $identitySvcToProject
90+ dotnet build $identitySvcToProject
91+ dotnet publish $identitySvcToProject - o $identitySvcPathToPub
92+
93+
94+ # Catalog Service: Build dotnet bits
95+ Write-Host " Catalog Service: Restore Dependencies, dotnet build and dotnet publish" - ForegroundColor Blue
96+ dotnet restore $catalogPathToProject
97+ dotnet build $catalogPathToProject
98+ dotnet publish $catalogPathToProject - o $catalogPathToPub
99+
100+
101+ # Ordering Service: Build dotnet bits
102+ Write-Host " Ordering Service: Restore Dependencies, dotnet build and dotnet publish" - ForegroundColor Blue
103+ dotnet restore $orderingPathToProject
104+ dotnet build $orderingPathToProject
105+ dotnet publish $orderingPathToProject - o $orderingPathToPub
106+
107+
108+ # Basket Service: Build dotnet bits
109+ Write-Host " Basket Service: Restore Dependencies, dotnet build and dotnet publish" - ForegroundColor Blue
110+ dotnet restore $basketPathToProject
111+ dotnet build $basketPathToProject
112+ dotnet publish $basketPathToProject - o $basketPathToPub
113+
114+
115+
116+ # #######################################################################################
117+ # Delete old eShop Docker images
118+ # #######################################################################################
79119
80120$imagesToDelete = docker images -- filter= reference= " eshop/*" - q
81121
@@ -92,10 +132,17 @@ Else
92132 docker rmi $ (docker images -- filter= reference= " eshop/*" - q) -f
93133}
94134
135+
136+ # #######################################################################################
137+ # Build new eShop images
138+ # #######################################################################################
139+
140+ # WE DON'T NEED DOCKER BUILD AS WE CAN RUN "DOCKER-COMPOSE BUILD" OR "DOCKER-COMPOSE UP" AND IT WILL BUILD ALL THE IMAGES IN THE .YML FOR US
141+
95142# *** build docker images ***
96- docker build - t eshop/ web $webPathToPub
97- docker build - t eshop/ catalog.api $catalogPathToPub
98- docker build - t eshop/ ordering.api $orderingApiPathToPub
99- docker build - t eshop/ basket.api $basketPathToPub
100- docker build - t eshop/ webspa $webSPAPathToPub
101- docker build - t eshop/ identity $identitySvcPathToPub
143+ # docker build -t eshop/web $webPathToPub
144+ # docker build -t eshop/catalog.api $catalogPathToPub
145+ # docker build -t eshop/ordering.api $orderingApiPathToPub
146+ # docker build -t eshop/basket.api $basketPathToPub
147+ # docker build -t eshop/webspa $webSPAPathToPub
148+ # docker build -t eshop/identity $identitySvcPathToPub
0 commit comments