From 9ccf7f11ce109203e444b4172c3ae4330268905e Mon Sep 17 00:00:00 2001 From: Cesar De la Torre Date: Thu, 16 Feb 2017 12:31:53 -0800 Subject: [PATCH] Changes for CLI compatibility and New .PDF version --- build-bits.ps1 | 181 +++++++++++------- docker-compose.override.yml | 20 +- docker-compose.vs.debug.yml | 28 +-- docker-compose.vs.release.yml | 18 +- docker-compose.yml | 16 +- .../Basket/Basket.API/Basket.API.csproj | 6 + .../Catalog/Catalog.API/Catalog.API.csproj | 6 + .../Identity/Identity.API/Identity.API.csproj | 6 + .../Identity.API/wwwroot/js/site.min.js | 1 - .../Ordering/Ordering.API/Ordering.API.csproj | 6 + src/Web/WebMVC/WebMVC.csproj | 6 + src/Web/WebMVC/wwwroot/js/site.min.js | 1 - .../eShopOnContainers.WebSPA.csproj | 6 + 13 files changed, 191 insertions(+), 110 deletions(-) diff --git a/build-bits.ps1 b/build-bits.ps1 index 3a33a6ee7..6a3a14840 100644 --- a/build-bits.ps1 +++ b/build-bits.ps1 @@ -2,80 +2,120 @@ $scriptPath = Split-Path $script:MyInvocation.MyCommand.Path Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow -$pubFolderToDelete = $scriptPath + "\pub" -remove-item -path $pubFolderToDelete -Force -Recurse -ErrorAction SilentlyContinue +# *** WebMVC paths *** +$webMVCPath = $scriptPath + "\src\Web\WebMVC" +$webMVCPathToProject = $webMVCPath + "\WebMVC.csproj" +Write-Host "webMVCPathToProject is $webMVCPathToProject" -ForegroundColor Yellow +$webMVCPathToPub = $webMVCPath + "\obj\Docker\publish" +Write-Host "webMVCPathToPub is $webMVCPathToPub" -ForegroundColor Yellow -# *** WebMVC image *** -$webPathToJson = $scriptPath + "\src\Web\WebMVC\project.json" -Write-Host "webPathToJson is $webPathToJson" -ForegroundColor Yellow -$webPathToPub = $scriptPath + "\pub\webMVC" -Write-Host "webPathToPub is $webPathToPub" -ForegroundColor Yellow -Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue -dotnet restore $webPathToJson -dotnet build $webPathToJson -dotnet publish $webPathToJson -o $webPathToPub - -# *** WebSPA image *** +# *** WebSPA paths *** $webSPAPath = $scriptPath + "\src\Web\WebSPA\eShopOnContainers.WebSPA" -$webSPAPathToJson = $webSPAPath + "\project.json" -Write-Host "webSPAPathToJson is $webSPAPathToJson" -ForegroundColor Yellow -$webSPAPathToPub = $scriptPath + "\pub\webSPA" +$webSPAPathToProject = $webSPAPath + "\eShopOnContainers.WebSPA.csproj" +Write-Host "webSPAPathToProject is $webSPAPathToProject" -ForegroundColor Yellow +$webSPAPathToPub = $webSPAPath + "\obj\Docker\publish" Write-Host "webSPAPathToPub is $webSPAPathToPub" -ForegroundColor Yellow -Write-Host "Installing npm dependencies" -Start-Process -WorkingDirectory $webSPAPath -NoNewWindow -Wait npm i - -Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue -dotnet restore $webSPAPathToJson -dotnet build $webSPAPathToJson -dotnet publish $webSPAPathToJson -o $webSPAPathToPub -# *** identitySvc image *** -$identitySvcPathToJson = $scriptPath + "\src\Services\Identity\Identity.API\project.json" -Write-Host "identitySvcPathToJson is $identitySvcPathToJson" -ForegroundColor Yellow -$identitySvcPathToPub = $scriptPath + "\pub\identity" +# *** IdentitySvc paths *** +$identitySvcPath = $scriptPath + "\src\Services\Identity\Identity.API" +$identitySvcToProject = $identitySvcPath + "\Identity.API.csproj" +Write-Host "identitySvcToProject is $identitySvcToProject" -ForegroundColor Yellow +$identitySvcPathToPub = $identitySvcPath + "\obj\Docker\publish" Write-Host "identitySvcPathToPub is $identitySvcPathToPub" -ForegroundColor Yellow -Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue -dotnet restore $identitySvcPathToJson -dotnet build $identitySvcPathToJson -dotnet publish $identitySvcPathToJson -o $identitySvcPathToPub -#*** Catalog service image *** -$catalogPathToJson = $scriptPath + "\src\Services\Catalog\Catalog.API\project.json" -Write-Host "catalogPathToJson is $catalogPathToJson" -ForegroundColor Yellow -$catalogPathToPub = $scriptPath + "\pub\catalog" +# *** Catalog paths *** +$catalogPath = $scriptPath + "\src\Services\Catalog\Catalog.API" +$catalogPathToProject = $catalogPath + "\Catalog.API.csproj" +Write-Host "catalogPathToProject is $catalogPathToProject" -ForegroundColor Yellow +$catalogPathToPub = $catalogPath + "\obj\Docker\publish" Write-Host "catalogPathToPub is $catalogPathToPub" -ForegroundColor Yellow -Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue -dotnet restore $catalogPathToJson -dotnet build $catalogPathToJson -dotnet publish $catalogPathToJson -o $catalogPathToPub - -#*** Ordering service image *** -$orderingPath = $scriptPath + "\src\Services\Ordering" -Write-Host "orderingPath is $orderingPath" -ForegroundColor Yellow -$orderingApiPathToJson = $orderingPath + "\Ordering.API\project.json" -Write-Host "orderingApiPathToJson is $orderingApiPathToJson" -ForegroundColor Yellow -$orderingApiPathToPub = $scriptPath + "\pub\ordering" -Write-Host "orderingApiPathToPub is $orderingApiPathToPub" -ForegroundColor Yellow - -Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue -dotnet restore $orderingPath -dotnet build $orderingApiPathToJson -dotnet publish $orderingApiPathToJson -o $orderingApiPathToPub - -#*** Basket service image *** -$basketPathToJson = $scriptPath + "\src\Services\Basket\Basket.API\project.json" -Write-Host "basketPathToJson is $basketPathToJson" -ForegroundColor Yellow -$basketPathToPub = $scriptPath + "\pub\basket" + +# *** Ordering paths *** +$orderingPath = $scriptPath + "\src\Services\Ordering\Ordering.API" +$orderingPathToProject = $orderingPath + "\Ordering.API.csproj" +Write-Host "orderingPathToProject is $orderingPathToProject" -ForegroundColor Yellow +$orderingPathToPub = $orderingPath + "\obj\Docker\publish" +Write-Host "orderingPathToPub is $orderingPathToPub" -ForegroundColor Yellow + +# *** Basket paths *** +$basketPath = $scriptPath + "\src\Services\Basket\Basket.API" +$basketPathToProject = $basketPath + "\Basket.API.csproj" +Write-Host "basketPathToProject is $basketPathToProject" -ForegroundColor Yellow +$basketPathToPub = $basketPath + "\obj\Docker\publish" Write-Host "basketPathToPub is $basketPathToPub" -ForegroundColor Yellow -Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue -dotnet restore $basketPathToJson -dotnet build $basketPathToJson -dotnet publish $basketPathToJson -o $basketPathToPub + +######################################################################################## +# Delete old eShop dotnet publish bits +######################################################################################## +Write-Host "Deleting previous dotnet publish bits from all projects" -ForegroundColor Blue + +remove-item -path $WebMVCPathToPub -Force -Recurse -ErrorAction SilentlyContinue +remove-item -path $webSPAPathToPub -Force -Recurse -ErrorAction SilentlyContinue +remove-item -path $identitySvcPathToPub -Force -Recurse -ErrorAction SilentlyContinue +remove-item -path $catalogPathToPub -Force -Recurse -ErrorAction SilentlyContinue +remove-item -path $orderingPathToPub -Force -Recurse -ErrorAction SilentlyContinue +remove-item -path $basketPathToPub -Force -Recurse -ErrorAction SilentlyContinue + + + +######################################################################################## +# Building DotNet bits +######################################################################################## + +# WebMVC: Build dotnet bits +Write-Host "WebMVC: Restore Dependencies, dotnet build and dotnet publish" -ForegroundColor Blue +dotnet restore $WebMVCPathToProject +dotnet build $WebMVCPathToProject +dotnet publish $WebMVCPathToProject -o $WebMVCPathToPub + + +# WebSPA: Build dotnet bits +Write-Host "WebSPA: Installing npm dependencies" +#TEMP COMMENT--- Start-Process -WorkingDirectory $webSPAPath -NoNewWindow -Wait npm i + +Write-Host "WebSPA: Restore Dependencies, dotnet build and dotnet publish" -ForegroundColor Blue +dotnet restore $webSPAPathToProject +dotnet build $webSPAPathToProject +dotnet publish $webSPAPathToProject -o $webSPAPathToPub + + +# Identity Service: Build dotnet bits +Write-Host "Identity Service: Restore Dependencies, dotnet build and dotnet publish" -ForegroundColor Blue +dotnet restore $identitySvcToProject +dotnet build $identitySvcToProject +dotnet publish $identitySvcToProject -o $identitySvcPathToPub + + +# Catalog Service: Build dotnet bits +Write-Host "Catalog Service: Restore Dependencies, dotnet build and dotnet publish" -ForegroundColor Blue +dotnet restore $catalogPathToProject +dotnet build $catalogPathToProject +dotnet publish $catalogPathToProject -o $catalogPathToPub + + +# Ordering Service: Build dotnet bits +Write-Host "Ordering Service: Restore Dependencies, dotnet build and dotnet publish" -ForegroundColor Blue +dotnet restore $orderingPathToProject +dotnet build $orderingPathToProject +dotnet publish $orderingPathToProject -o $orderingPathToPub + + +# Basket Service: Build dotnet bits +Write-Host "Basket Service: Restore Dependencies, dotnet build and dotnet publish" -ForegroundColor Blue +dotnet restore $basketPathToProject +dotnet build $basketPathToProject +dotnet publish $basketPathToProject -o $basketPathToPub + + + +######################################################################################## +# Delete old eShop Docker images +######################################################################################## $imagesToDelete = docker images --filter=reference="eshop/*" -q @@ -92,10 +132,17 @@ Else docker rmi $(docker images --filter=reference="eshop/*" -q) -f } + +######################################################################################## +# Build new eShop images +######################################################################################## + +# 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 + #*** build docker images *** -docker build -t eshop/web $webPathToPub -docker build -t eshop/catalog.api $catalogPathToPub -docker build -t eshop/ordering.api $orderingApiPathToPub -docker build -t eshop/basket.api $basketPathToPub -docker build -t eshop/webspa $webSPAPathToPub -docker build -t eshop/identity $identitySvcPathToPub \ No newline at end of file +# docker build -t eshop/web $webPathToPub +# docker build -t eshop/catalog.api $catalogPathToPub +# docker build -t eshop/ordering.api $orderingApiPathToPub +# docker build -t eshop/basket.api $basketPathToPub +# docker build -t eshop/webspa $webSPAPathToPub +# docker build -t eshop/identity $identitySvcPathToPub \ No newline at end of file diff --git a/docker-compose.override.yml b/docker-compose.override.yml index c07f0081d..46fa88028 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -39,16 +39,16 @@ services: ports: - "5102:5102" - eshoponcontainers.webspa: - environment: - - ASPNETCORE_ENVIRONMENT=Development - - CatalogUrl=http://10.0.75.1:5101 - - OrderingUrl=http://10.0.75.1: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 - ports: - - "5104:5104" +# eshoponcontainers.webspa: +# environment: +# - ASPNETCORE_ENVIRONMENT=Development +# - CatalogUrl=http://10.0.75.1:5101 +# - OrderingUrl=http://10.0.75.1: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 +# ports: +# - "5104:5104" webmvc: environment: diff --git a/docker-compose.vs.debug.yml b/docker-compose.vs.debug.yml index 4d6571e99..c71c3003f 100644 --- a/docker-compose.vs.debug.yml +++ b/docker-compose.vs.debug.yml @@ -61,20 +61,20 @@ services: labels: - "com.microsoft.visualstudio.targetoperatingsystem=linux" - eshoponcontainers.webspa: - image: eshop/eshoponcontainers.webspa:dev - build: - args: - source: ${DOCKER_BUILD_SOURCE} - environment: - - DOTNET_USE_POLLING_FILE_WATCHER=1 - volumes: - - ./src/Web/WebSPA/eShopOnContainers.WebSPA:/app - - ~/.nuget/packages:/root/.nuget/packages:ro - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" +# eshoponcontainers.webspa: +# image: eshop/eshoponcontainers.webspa:dev +# build: +# args: +# source: ${DOCKER_BUILD_SOURCE} +# environment: +# - DOTNET_USE_POLLING_FILE_WATCHER=1 +# volumes: +# - ./src/Web/WebSPA/eShopOnContainers.WebSPA:/app +# - ~/.nuget/packages:/root/.nuget/packages:ro +# - ~/clrdbg:/clrdbg:ro +# entrypoint: tail -f /dev/null +# labels: +# - "com.microsoft.visualstudio.targetoperatingsystem=linux" webmvc: image: eshop/webmvc:dev diff --git a/docker-compose.vs.release.yml b/docker-compose.vs.release.yml index 17248ac5c..3b2863feb 100644 --- a/docker-compose.vs.release.yml +++ b/docker-compose.vs.release.yml @@ -41,15 +41,15 @@ services: labels: - "com.microsoft.visualstudio.targetoperatingsystem=linux" - eshoponcontainers.webspa: - build: - args: - source: ${DOCKER_BUILD_SOURCE} - volumes: - - ~/clrdbg:/clrdbg:ro - entrypoint: tail -f /dev/null - labels: - - "com.microsoft.visualstudio.targetoperatingsystem=linux" +# eshoponcontainers.webspa: +# build: +# args: +# source: ${DOCKER_BUILD_SOURCE} +# volumes: +# - ~/clrdbg:/clrdbg:ro +# entrypoint: tail -f /dev/null +# labels: +# - "com.microsoft.visualstudio.targetoperatingsystem=linux" webmvc: build: diff --git a/docker-compose.yml b/docker-compose.yml index 896663669..6e19724bc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,14 +34,14 @@ services: depends_on: - sql.data - eshoponcontainers.webspa: - image: eshop/eshoponcontainers.webspa - build: - context: ./src/Web/WebSPA/eShopOnContainers.WebSPA - dockerfile: Dockerfile - depends_on: - - identity.api - - basket.api +# eshoponcontainers.webspa: +# image: eshop/eshoponcontainers.webspa +# build: +# context: ./src/Web/WebSPA/eShopOnContainers.WebSPA +# dockerfile: Dockerfile +# depends_on: +# - identity.api +# - basket.api webmvc: image: eshop/webmvc diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index bd9f27fd6..925653aa0 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -36,4 +36,10 @@ + + + Always + + + diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index fba70291c..da627dec1 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -44,4 +44,10 @@ + + + Always + + + diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 5ce6858e7..4f7e870a1 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -63,4 +63,10 @@ + + + Always + + + diff --git a/src/Services/Identity/Identity.API/wwwroot/js/site.min.js b/src/Services/Identity/Identity.API/wwwroot/js/site.min.js index e5539c1df..e69de29bb 100644 --- a/src/Services/Identity/Identity.API/wwwroot/js/site.min.js +++ b/src/Services/Identity/Identity.API/wwwroot/js/site.min.js @@ -1 +0,0 @@ -// Write your Javascript code. \ No newline at end of file diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index 67b533c8c..ba1f30465 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -54,4 +54,10 @@ + + + Always + + + diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index 41100b146..8cc66b8ff 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -56,4 +56,10 @@ + + + Always + + + diff --git a/src/Web/WebMVC/wwwroot/js/site.min.js b/src/Web/WebMVC/wwwroot/js/site.min.js index e5539c1df..e69de29bb 100644 --- a/src/Web/WebMVC/wwwroot/js/site.min.js +++ b/src/Web/WebMVC/wwwroot/js/site.min.js @@ -1 +0,0 @@ -// Write your Javascript code. \ No newline at end of file diff --git a/src/Web/WebSPA/eShopOnContainers.WebSPA/eShopOnContainers.WebSPA.csproj b/src/Web/WebSPA/eShopOnContainers.WebSPA/eShopOnContainers.WebSPA.csproj index 0479f6fe8..a5b90c3a2 100644 --- a/src/Web/WebSPA/eShopOnContainers.WebSPA/eShopOnContainers.WebSPA.csproj +++ b/src/Web/WebSPA/eShopOnContainers.WebSPA/eShopOnContainers.WebSPA.csproj @@ -57,4 +57,10 @@ + + + Always + + +