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.

48 lines
2.1 KiB

  1. Param(
  2. [ValidateSet(nanowin", "linux")] [String] [Parameter(Mandatory=$true)] $Platform,
  3. [bool] $DeleteImages = $false
  4. )
  5. $scriptPath = Split-Path $script:MyInvocation.MyCommand.Path
  6. $Platform = $Platform.ToLowerInvariant()
  7. $SourcePerPlatformDockerFilesPath = "$ScriptPath\_docker\$Platform\extradf"
  8. $TargetPerPlatformDockerFilesPath = "$ScriptPath\extradf"
  9. Write-Host "Current script directory is $scriptPath" -ForegroundColor Yellow
  10. If ($DeleteImages) {
  11. Write-Host "Deleting eShop Docker images"
  12. & "$ScriptPath\delete-images.ps1"
  13. }
  14. If (Test-Path $TargetPerPlatformDockerFilesPath) {
  15. Write-Host "Found per-platform extra Docker files. Removing..."
  16. Remove-Item "$TargetPerPlatformDockerFilesPath\" -Recurse -Force
  17. }
  18. If (Test-Path $SourcePerPlatformDockerFilesPath) {
  19. Write-Host "Copying per-platform extra Dockerfiles"
  20. Copy-Item "$SourcePerPlatformDockerFilesPath\*" "$ScriptPath\extradf\" -Recurse -Force
  21. }
  22. else {
  23. Write-Host "There are not extra Dockerfiles for platform $Platform"
  24. }
  25. Write-Host "Changing Dockerfiles"
  26. Copy-Item "$ScriptPath\src\Services\Basket\Basket.API\Dockerfile.$Platform" "$ScriptPath\src\Services\Basket\Basket.API\Dockerfile" -Force
  27. Copy-Item "$ScriptPath\src\Services\Catalog\Catalog.API\Dockerfile.$Platform" "$ScriptPath\src\Services\Catalog\Catalog.API\Dockerfile" -Force
  28. Copy-Item "$ScriptPath\src\Services\Identity\Identity.API\Dockerfile.$Platform" "$ScriptPath\src\Services\Identity\Identity.API\Dockerfile" -Force
  29. Copy-Item "$ScriptPath\src\Services\Ordering\Ordering.API\Dockerfile.$Platform" "$ScriptPath\src\Services\Ordering\Ordering.API\Dockerfile" -Force
  30. Copy-Item "$ScriptPath\src\Web\WebMVC\Dockerfile.$Platform" "$ScriptPath\src\Web\WebMVC\Dockerfile" -Force
  31. Copy-Item "$ScriptPath\src\Web\WebSPA\Dockerfile.$Platform" "$ScriptPath\src\Web\WebSPA\Dockerfile" -Force
  32. Write-Host "Replacing Docker-compose"
  33. Copy-Item "$ScriptPath\_docker\$Platform\*.yml" "$ScriptPath\" -Force
  34. Remove-Item "$ScriptPath\.eshopdocker_*" -Force -ErrorAction SilentlyContinue
  35. New-Item "$ScriptPath\.eshopdocker_$Platform" -ItemType File | Out-Null
  36. Write-Host "Done. Docker files are set for platform: $Platform"