From bb5d48735dd4baf26872f8afc196d3759644e67a Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Wed, 15 Feb 2017 10:44:59 -0500 Subject: [PATCH] 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. --- build-bits.sh | 45 ++++++++++++++----- docker-compose.override.yml | 22 ++++----- docker-compose.yml | 4 +- .../Basket/Basket.API/Basket.API.csproj | 5 ++- .../Catalog/Catalog.API/Catalog.API.csproj | 10 ++++- .../Identity/Identity.API/Identity.API.csproj | 11 ++++- .../Ordering/Ordering.API/Ordering.API.csproj | 5 ++- src/Web/WebMVC/WebMVC.csproj | 14 +++++- .../eShopOnContainers.WebSPA.csproj | 21 ++++++++- 9 files changed, 107 insertions(+), 30 deletions(-) mode change 100644 => 100755 build-bits.sh diff --git a/build-bits.sh b/build-bits.sh old mode 100644 new mode 100755 index 4e86be0e9..6575b4f7c --- a/build-bits.sh +++ b/build-bits.sh @@ -1,12 +1,35 @@ #!/bin/sh -#dotnet restore -rm -rf ./pub -dotnet publish "$(pwd)/src/Web/WebMVC/project.json" -o "$(pwd)/pub/webMVC" -dotnet publish "$(pwd)/src/Services/Catalog/Catalog.API/project.json" -o "$(pwd)/pub/catalog" -dotnet publish "$(pwd)/src/Services/Ordering/Ordering.API/project.json" -o "$(pwd)/pub/ordering" -dotnet publish "$(pwd)/src/Services/Basket/Basket.API/project.json" -o "$(pwd)/pub/basket" - -docker build -t eshop/web "$(pwd)/pub/webMVC" -docker build -t eshop/catalog.api "$(pwd)/pub/catalog" -docker build -t eshop/ordering.api "$(pwd)/pub/ordering" -docker build -t eshop/basket.api "$(pwd)/pub/basket" \ No newline at end of file + +projectList=( + "src/Services/Catalog/Catalog.API" + "src/Services/Basket/Basket.API" + "src/Services/Ordering/Ordering.API" + "src/Services/Identity/Identity.API" + "src/Web/WebMVC" + "src/Web/WebSPA/eShopOnContainers.WebSPA" +) + +for project in "${projectList[@]}" +do + echo -e "\e[33mWorking on $(pwd)/$project" + echo -e "\e[33m\tRemoving old publish output" + pushd $(pwd)/$project + rm -rf obj/Docker/publish + echo -e "\e[33m\tRestoring project" + dotnet restore + echo -e "\e[33m\tBuilding and publishing projects" + dotnet publish -o obj/Docker/publish + popd +done + +# remove old docker images: +images=$(docker images --filter=reference="eshop/*" -q) +if [ -n "$images" ]; then + docker rm $(docker ps -a -q) -f + echo "Deleting eShop images in local Docker repo" + echo $images + docker rmi $(docker images --filter=reference="eshop/*" -q) -f +fi + +# No need to build the images, docker build or docker compose will +# do that using the images and containers defined in the docker-compose.yml file. diff --git a/docker-compose.override.yml b/docker-compose.override.yml index c07f0081d..7d5fd0903 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -1,12 +1,13 @@ version: '2' services: + basket.api: environment: - ASPNETCORE_ENVIRONMENT=Development - ConnectionString=basket.data #- identityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105. - - 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. + - identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. ports: - "5103:5103" @@ -15,18 +16,17 @@ services: - ASPNETCORE_ENVIRONMENT=Development - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word #- ExternalCatalogBaseUrl=http://13.88.8.119:5101 #Remote: VM Needs to have public access at 5105. - - 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. + - ExternalCatalogBaseUrl=http://localhost:5101 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. ports: - "5101:5101" - identity.api: environment: - ASPNETCORE_ENVIRONMENT=Development - SpaClient=http://localhost:5104 - ConnectionStrings__DefaultConnection=Server=sql.data;Database=Microsoft.eShopOnContainers.Service.IdentityDb;User Id=sa;Password=Pass@word #- MvcClient=http://13.88.8.119:5100 #Remote: VM Needs to have public access at 5105. - - MvcClient=http://10.0.75.1:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. + - MvcClient=http://localhost:5100 #Local: You need to open your local dev-machine firewall at range 5100-5105. ports: - "5105:5105" @@ -35,18 +35,18 @@ services: - ASPNETCORE_ENVIRONMENT=Development - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.OrderingDb;User Id=sa;Password=Pass@word #- identityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105. - - 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. + - identityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. ports: - "5102:5102" - eshoponcontainers.webspa: + webspa: environment: - ASPNETCORE_ENVIRONMENT=Development - - CatalogUrl=http://10.0.75.1:5101 - - OrderingUrl=http://10.0.75.1:5102 + - CatalogUrl=http://localhost:5101 + - OrderingUrl=http://localhost:5102 #- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105. - - 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. - - BasketUrl=http://10.0.75.1:5103 + - IdentityUrl=http://localhost:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. + - BasketUrl=http://localhost:5103 ports: - "5104:5104" @@ -56,7 +56,7 @@ services: - CatalogUrl=http://catalog.api:5101 - OrderingUrl=http://ordering.api:5102 #- IdentityUrl=http://13.88.8.119:5105 #Remote: VM Needs to have public access at 5105. - - 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. + - IdentityUrl=http://identity.api:5105 #Local: You need to open your local dev-machine firewall at range 5100-5105. at range 5100-5105. - BasketUrl=http://basket.api:5103 ports: - "5100:5100" diff --git a/docker-compose.yml b/docker-compose.yml index 896663669..e5f83475b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,8 +34,8 @@ services: depends_on: - sql.data - eshoponcontainers.webspa: - image: eshop/eshoponcontainers.webspa + webspa: + image: eshop/webspa build: context: ./src/Web/WebSPA/eShopOnContainers.WebSPA dockerfile: Dockerfile diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index 925653aa0..fc040b3b0 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -13,7 +13,10 @@ - + + PreserveNewest + + PreserveNewest diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 2b473fd55..15be6a8c2 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -13,12 +13,20 @@ ..\..\..\..\docker-compose.dcproj + - + + PreserveNewest + + + PreserveNewest + + PreserveNewest + diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 4f7e870a1..b810aae66 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -14,7 +14,16 @@ - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + PreserveNewest diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index ba1f30465..d83aed609 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -14,7 +14,10 @@ - + + PreserveNewest + + PreserveNewest diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index 8cc66b8ff..3b2e8c147 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -14,7 +14,19 @@ - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + PreserveNewest diff --git a/src/Web/WebSPA/eShopOnContainers.WebSPA/eShopOnContainers.WebSPA.csproj b/src/Web/WebSPA/eShopOnContainers.WebSPA/eShopOnContainers.WebSPA.csproj index 4cbee8d8e..3a7cf00b8 100644 --- a/src/Web/WebSPA/eShopOnContainers.WebSPA/eShopOnContainers.WebSPA.csproj +++ b/src/Web/WebSPA/eShopOnContainers.WebSPA/eShopOnContainers.WebSPA.csproj @@ -17,7 +17,25 @@ - + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + PreserveNewest @@ -50,6 +68,7 @@ +