Skip to content

Commit 9ccf7f1

Browse files
Changes for CLI compatibility and New .PDF version
1 parent 2576c69 commit 9ccf7f1

13 files changed

Lines changed: 191 additions & 110 deletions

File tree

build-bits.ps1

Lines changed: 114 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,80 +2,120 @@ $scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
22

33
Write-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"
2418
Write-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"
3826
Write-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"
4934
Write-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"
7349
Write-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

docker-compose.override.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ services:
3939
ports:
4040
- "5102:5102"
4141

42-
eshoponcontainers.webspa:
43-
environment:
44-
- ASPNETCORE_ENVIRONMENT=Development
45-
- CatalogUrl=http://10.0.75.1:5101
46-
- OrderingUrl=http://10.0.75.1:5102
47-
#- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
48-
- IdentityUrl=http://10.0.75.1:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
49-
- BasketUrl=http://10.0.75.1:5103
50-
ports:
51-
- "5104:5104"
42+
# eshoponcontainers.webspa:
43+
# environment:
44+
# - ASPNETCORE_ENVIRONMENT=Development
45+
# - CatalogUrl=http://10.0.75.1:5101
46+
# - OrderingUrl=http://10.0.75.1:5102
47+
# #- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
48+
# - IdentityUrl=http://10.0.75.1:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
49+
# - BasketUrl=http://10.0.75.1:5103
50+
# ports:
51+
# - "5104:5104"
5252

5353
webmvc:
5454
environment:

docker-compose.vs.debug.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,20 @@ services:
6161
labels:
6262
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
6363

64-
eshoponcontainers.webspa:
65-
image: eshop/eshoponcontainers.webspa:dev
66-
build:
67-
args:
68-
source: ${DOCKER_BUILD_SOURCE}
69-
environment:
70-
- DOTNET_USE_POLLING_FILE_WATCHER=1
71-
volumes:
72-
- ./src/Web/WebSPA/eShopOnContainers.WebSPA:/app
73-
- ~/.nuget/packages:/root/.nuget/packages:ro
74-
- ~/clrdbg:/clrdbg:ro
75-
entrypoint: tail -f /dev/null
76-
labels:
77-
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
64+
# eshoponcontainers.webspa:
65+
# image: eshop/eshoponcontainers.webspa:dev
66+
# build:
67+
# args:
68+
# source: ${DOCKER_BUILD_SOURCE}
69+
# environment:
70+
# - DOTNET_USE_POLLING_FILE_WATCHER=1
71+
# volumes:
72+
# - ./src/Web/WebSPA/eShopOnContainers.WebSPA:/app
73+
# - ~/.nuget/packages:/root/.nuget/packages:ro
74+
# - ~/clrdbg:/clrdbg:ro
75+
# entrypoint: tail -f /dev/null
76+
# labels:
77+
# - "com.microsoft.visualstudio.targetoperatingsystem=linux"
7878

7979
webmvc:
8080
image: eshop/webmvc:dev

docker-compose.vs.release.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ services:
4141
labels:
4242
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
4343

44-
eshoponcontainers.webspa:
45-
build:
46-
args:
47-
source: ${DOCKER_BUILD_SOURCE}
48-
volumes:
49-
- ~/clrdbg:/clrdbg:ro
50-
entrypoint: tail -f /dev/null
51-
labels:
52-
- "com.microsoft.visualstudio.targetoperatingsystem=linux"
44+
# eshoponcontainers.webspa:
45+
# build:
46+
# args:
47+
# source: ${DOCKER_BUILD_SOURCE}
48+
# volumes:
49+
# - ~/clrdbg:/clrdbg:ro
50+
# entrypoint: tail -f /dev/null
51+
# labels:
52+
# - "com.microsoft.visualstudio.targetoperatingsystem=linux"
5353

5454
webmvc:
5555
build:

docker-compose.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ services:
3434
depends_on:
3535
- sql.data
3636

37-
eshoponcontainers.webspa:
38-
image: eshop/eshoponcontainers.webspa
39-
build:
40-
context: ./src/Web/WebSPA/eShopOnContainers.WebSPA
41-
dockerfile: Dockerfile
42-
depends_on:
43-
- identity.api
44-
- basket.api
37+
# eshoponcontainers.webspa:
38+
# image: eshop/eshoponcontainers.webspa
39+
# build:
40+
# context: ./src/Web/WebSPA/eShopOnContainers.WebSPA
41+
# dockerfile: Dockerfile
42+
# depends_on:
43+
# - identity.api
44+
# - basket.api
4545

4646
webmvc:
4747
image: eshop/webmvc

src/Services/Basket/Basket.API/Basket.API.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,10 @@
3636
<PackageReference Include="Swashbuckle" Version="6.0.0-beta902" />
3737
</ItemGroup>
3838

39+
<ItemGroup>
40+
<None Update="Dockerfile">
41+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
42+
</None>
43+
</ItemGroup>
44+
3945
</Project>

src/Services/Catalog/Catalog.API/Catalog.API.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,10 @@
4444
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild3-final" />
4545
</ItemGroup>
4646

47+
<ItemGroup>
48+
<None Update="Dockerfile">
49+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
50+
</None>
51+
</ItemGroup>
52+
4753
</Project>

src/Services/Identity/Identity.API/Identity.API.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,10 @@
6363
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
6464
</ItemGroup>
6565

66+
<ItemGroup>
67+
<None Update="Dockerfile">
68+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
69+
</None>
70+
</ItemGroup>
71+
6672
</Project>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
// Write your Javascript code.

src/Services/Ordering/Ordering.API/Ordering.API.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,10 @@
5454
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.1.0-preview4-final" />
5555
</ItemGroup>
5656

57+
<ItemGroup>
58+
<None Update="Dockerfile">
59+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
60+
</None>
61+
</ItemGroup>
62+
5763
</Project>

0 commit comments

Comments
 (0)