Skip to content

Commit bb5d487

Browse files
committed
update build script for Mac
Until adding these, the project would not build correctly on a Mac. script working for SPA Add execute permissions to build-bits.sh on macOS fix a rebase / automatic merge issue. Somehow, the MVC image got in there twice. update content nodes Bug workaround for for the CLI. It turns out that the CLI does not handle content nodes that have multiple paths. Instead, multiple nodes are needed. use the standard names for the web docker images. fix a typo and update the csproj content listings. Also, execute nom install as part of publishing the spa application.
1 parent 2f54214 commit bb5d487

9 files changed

Lines changed: 107 additions & 30 deletions

File tree

build-bits.sh

100644100755
Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
11
#!/bin/sh
2-
#dotnet restore
3-
rm -rf ./pub
4-
dotnet publish "$(pwd)/src/Web/WebMVC/project.json" -o "$(pwd)/pub/webMVC"
5-
dotnet publish "$(pwd)/src/Services/Catalog/Catalog.API/project.json" -o "$(pwd)/pub/catalog"
6-
dotnet publish "$(pwd)/src/Services/Ordering/Ordering.API/project.json" -o "$(pwd)/pub/ordering"
7-
dotnet publish "$(pwd)/src/Services/Basket/Basket.API/project.json" -o "$(pwd)/pub/basket"
8-
9-
docker build -t eshop/web "$(pwd)/pub/webMVC"
10-
docker build -t eshop/catalog.api "$(pwd)/pub/catalog"
11-
docker build -t eshop/ordering.api "$(pwd)/pub/ordering"
12-
docker build -t eshop/basket.api "$(pwd)/pub/basket"
2+
3+
projectList=(
4+
"src/Services/Catalog/Catalog.API"
5+
"src/Services/Basket/Basket.API"
6+
"src/Services/Ordering/Ordering.API"
7+
"src/Services/Identity/Identity.API"
8+
"src/Web/WebMVC"
9+
"src/Web/WebSPA/eShopOnContainers.WebSPA"
10+
)
11+
12+
for project in "${projectList[@]}"
13+
do
14+
echo -e "\e[33mWorking on $(pwd)/$project"
15+
echo -e "\e[33m\tRemoving old publish output"
16+
pushd $(pwd)/$project
17+
rm -rf obj/Docker/publish
18+
echo -e "\e[33m\tRestoring project"
19+
dotnet restore
20+
echo -e "\e[33m\tBuilding and publishing projects"
21+
dotnet publish -o obj/Docker/publish
22+
popd
23+
done
24+
25+
# remove old docker images:
26+
images=$(docker images --filter=reference="eshop/*" -q)
27+
if [ -n "$images" ]; then
28+
docker rm $(docker ps -a -q) -f
29+
echo "Deleting eShop images in local Docker repo"
30+
echo $images
31+
docker rmi $(docker images --filter=reference="eshop/*" -q) -f
32+
fi
33+
34+
# No need to build the images, docker build or docker compose will
35+
# do that using the images and containers defined in the docker-compose.yml file.

docker-compose.override.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
version: '2'
22

33
services:
4+
45
basket.api:
56
environment:
67
- ASPNETCORE_ENVIRONMENT=Development
78
- ConnectionString=basket.data
89
#- identityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
9-
- 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.
10+
- identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
1011
ports:
1112
- "5103:5103"
1213

@@ -15,18 +16,17 @@ services:
1516
- ASPNETCORE_ENVIRONMENT=Development
1617
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word
1718
#- ExternalCatalogBaseUrl=http://13.88.8.119:5101 #Remote: VM Needs to have public access at 5105.
18-
- ExternalCatalogBaseUrl=http://10.0.75.1:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
19+
- ExternalCatalogBaseUrl=http://localhost:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
1920
ports:
2021
- "5101:5101"
2122

22-
2323
identity.api:
2424
environment:
2525
- ASPNETCORE_ENVIRONMENT=Development
2626
- SpaClient=http://localhost:5104
2727
- ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word
2828
#- MvcClient=http://13.88.8.119:5100 #Remote: VM Needs to have public access at 5105.
29-
- MvcClient=http://10.0.75.1:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105.
29+
- MvcClient=http://localhost:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105.
3030
ports:
3131
- "5105:5105"
3232

@@ -35,18 +35,18 @@ services:
3535
- ASPNETCORE_ENVIRONMENT=Development
3636
- ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word
3737
#- identityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
38-
- 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.
38+
- identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
3939
ports:
4040
- "5102:5102"
4141

42-
eshoponcontainers.webspa:
42+
webspa:
4343
environment:
4444
- ASPNETCORE_ENVIRONMENT=Development
45-
- CatalogUrl=http://10.0.75.1:5101
46-
- OrderingUrl=http://10.0.75.1:5102
45+
- CatalogUrl=http://localhost:5101
46+
- OrderingUrl=http://localhost:5102
4747
#- 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
48+
- IdentityUrl=http://localhost:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
49+
- BasketUrl=http://localhost:5103
5050
ports:
5151
- "5104:5104"
5252

@@ -56,7 +56,7 @@ services:
5656
- CatalogUrl=http://catalog.api:5101
5757
- OrderingUrl=http://ordering.api:5102
5858
#- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105.
59-
- 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.
59+
- IdentityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105.
6060
- BasketUrl=http://basket.api:5103
6161
ports:
6262
- "5100:5100"

docker-compose.yml

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

37-
eshoponcontainers.webspa:
38-
image: eshop/eshoponcontainers.webspa
37+
webspa:
38+
image: eshop/webspa
3939
build:
4040
context: ./src/Web/WebSPA/eShopOnContainers.WebSPA
4141
dockerfile: Dockerfile

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<Content Update="wwwroot;Views;Areas\**\Views;appsettings.json;web.config;Dockerfile;docker-compose.yml;.dockerignore">
16+
<Content Update="web.config">
17+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
18+
</Content>
19+
<Content Include=".dockerignore">
1720
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
1821
</Content>
1922
</ItemGroup>

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@
1313
<DockerComposeProjectPath>..\..\..\..\docker-compose.dcproj</DockerComposeProjectPath>
1414
</PropertyGroup>
1515

16+
1617
<ItemGroup>
17-
<Content Update="wwwroot;Pics\**\*;Views;Areas\**\Views;settings.json;web.config;project.json;Dockerfile">
18+
<Content Update="wwwroot;">
19+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
20+
</Content>
21+
<Content Include="Pics\**\*;">
22+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
23+
</Content>
24+
<Content Update="web.config;">
1825
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
1926
</Content>
2027
</ItemGroup>
2128

29+
2230
<ItemGroup>
2331
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" />
2432
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<Content Update="wwwroot\**\*;Views\**\*;Areas\**\Views;appsettings.json;web.config;Dockerfile;docker-compose.yml;.dockerignore">
17+
<Content Update="wwwroot;">
18+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
19+
</Content>
20+
<Content Update="Views\**\*;">
21+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
22+
</Content>
23+
<Content Update="web.config;">
24+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
25+
</Content>
26+
<Content Include=".dockerignore">
1827
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
1928
</Content>
2029
</ItemGroup>

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<Content Update="wwwroot;Views;Areas\**\Views;settings.json;web.config;docker-compose.yml;docker-compose.debug.yml;Dockerfile.debug;Dockerfile;.dockerignore">
17+
<Content Update="web.config;">
18+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
19+
</Content>
20+
<Content Include=".dockerignore;">
1821
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
1922
</Content>
2023
</ItemGroup>

src/Web/WebMVC/WebMVC.csproj

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,19 @@
1414
</PropertyGroup>
1515

1616
<ItemGroup>
17-
<Content Update="wwwroot\**\*;Views\**\*;Areas\**\Views;appsettings.json;appsettings.override.json;web.config;Dockerfile;docker-compose.yml;.dockerignore">
17+
<Content Update="wwwroot\**\*;">
18+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
19+
</Content>
20+
<Content Update="Views\**\*;">
21+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
22+
</Content>
23+
<Content Update="appsettings.json;">
24+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
25+
</Content>
26+
<Content Update="web.config">
27+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
28+
</Content>
29+
<Content Update=".dockerignore">
1830
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
1931
</Content>
2032
</ItemGroup>

src/Web/WebSPA/eShopOnContainers.WebSPA/eShopOnContainers.WebSPA.csproj

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,25 @@
1717

1818
<ItemGroup>
1919
<Compile Remove="node_modules\**\*;Client\**\*" />
20-
<Content Update="appsettings.json;Client\**\*;typings;Views\**\*;tsconfig.json;tsd.json;web.config;config\**\*;wwwroot\**\*;dockerfile">
20+
<Content Update="appsettings.json;">
21+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
22+
</Content>
23+
<Content Update="Client\**\*;">
24+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
25+
</Content>
26+
<Content Update="Views\**\*;">
27+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
28+
</Content>
29+
<Content Update="tsconfig.json;">
30+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
31+
</Content>
32+
<Content Update="web.config;">
33+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
34+
</Content>
35+
<Content Update="config\**\*;">
36+
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
37+
</Content>
38+
<Content Update="wwwroot\**\*;">
2139
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
2240
</Content>
2341
</ItemGroup>
@@ -50,6 +68,7 @@
5068
</ItemGroup>
5169

5270
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
71+
<Exec Command="npm install" />
5372
<Exec Command="npm run build:prod" />
5473
</Target>
5574

0 commit comments

Comments
 (0)