You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
3.5 KiB

  1. $scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
  2. Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow
  3. $pubFolderToDelete = $scriptPath + "..\..\pub"
  4. remove-item -path $pubFolderToDelete -Force -Recurse -ErrorAction SilentlyContinue
  5. #cmd /c "rd /s pub" /q
  6. # *** WebMVC image ***
  7. $webPathToJson = $scriptPath + "\src\Web\WebMVC\project.json"
  8. Write-Host "webPathToJson is $webPathToJson" -ForegroundColor Yellow
  9. $webPathToPub = $scriptPath + "\pub\webMVC"
  10. Write-Host "webPathToPub is $webPathToPub" -ForegroundColor Yellow
  11. Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
  12. dotnet restore $webPathToJson
  13. dotnet build $webPathToJson
  14. dotnet publish $webPathToJson -o $webPathToPub
  15. # *** identitySvc image ***
  16. $identitySvcPathToJson = $scriptPath + "\src\Services\Identity\eShopOnContainers.Identity\project.json"
  17. Write-Host "identitySvcPathToJson is $identitySvcPathToJson" -ForegroundColor Yellow
  18. $identitySvcPathToPub = $scriptPath + "\pub\identity"
  19. Write-Host "identitySvcPathToPub is $identitySvcPathToPub" -ForegroundColor Yellow
  20. Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
  21. dotnet restore $identitySvcPathToJson
  22. dotnet build $identitySvcPathToJson
  23. dotnet publish $identitySvcPathToJson -o $identitySvcPathToPub
  24. #*** Catalog service image ***
  25. $catalogPathToJson = $scriptPath + "\src\Services\Catalog\Catalog.API\project.json"
  26. Write-Host "catalogPathToJson is $catalogPathToJson" -ForegroundColor Yellow
  27. $catalogPathToPub = $scriptPath + "\pub\catalog"
  28. Write-Host "catalogPathToPub is $catalogPathToPub" -ForegroundColor Yellow
  29. Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
  30. dotnet restore $catalogPathToJson
  31. dotnet build $catalogPathToJson
  32. dotnet publish $catalogPathToJson -o $catalogPathToPub
  33. #*** Ordering service image ***
  34. $orderingPath = $scriptPath + "\src\Services\Ordering"
  35. Write-Host "orderingPath is $orderingPath" -ForegroundColor Yellow
  36. $orderingApiPathToJson = $orderingPath + "\Ordering.API\project.json"
  37. Write-Host "orderingApiPathToJson is $orderingApiPathToJson" -ForegroundColor Yellow
  38. $orderingApiPathToPub = $scriptPath + "\pub\ordering"
  39. Write-Host "orderingApiPathToPub is $orderingApiPathToPub" -ForegroundColor Yellow
  40. Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
  41. dotnet restore $orderingPath
  42. dotnet build $orderingApiPathToJson
  43. dotnet publish $orderingApiPathToJson -o $orderingApiPathToPub
  44. #*** Basket service image ***
  45. $basketPathToJson = $scriptPath + "\src\Services\Basket\Basket.API\project.json"
  46. Write-Host "basketPathToJson is $basketPathToJson" -ForegroundColor Yellow
  47. $basketPathToPub = $scriptPath + "\pub\basket"
  48. Write-Host "basketPathToPub is $basketPathToPub" -ForegroundColor Yellow
  49. Write-Host "Restore Dependencies just in case as it is needed to run dotnet publish" -ForegroundColor Blue
  50. dotnet restore $basketPathToJson
  51. dotnet build $basketPathToJson
  52. dotnet publish $basketPathToJson -o $basketPathToPub
  53. # Delete all eshop containers
  54. docker rm $(docker images --filter=reference="eshop/*" -q) -f
  55. # Delete all eshop images
  56. docker rmi $(docker images --filter=reference="eshop/*" -q)
  57. #*** build docker images ***
  58. docker build -t eshop/web $webPathToPub
  59. docker build -t eshop/catalog.api $catalogPathToPub
  60. docker build -t eshop/ordering.api $orderingPathToPub
  61. docker build -t eshop/basket.api $basketPathToPub
  62. docker build -t eshop/identity $identitySvcPathToPub