windows.ps1 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Builds the Windows binary.
  2. #
  3. # From a fresh 64-bit Windows 10 install, prepare the system as follows:
  4. #
  5. # 1. Install Git:
  6. #
  7. # http://git-scm.com/download/win
  8. #
  9. # 2. Install Python 3.9.x:
  10. #
  11. # https://www.python.org/downloads/
  12. #
  13. # 3. Append ";C:\Python39;C:\Python39\Scripts" to the "Path" environment variable:
  14. #
  15. # https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sysdm_advancd_environmnt_addchange_variable.mspx?mfr=true
  16. #
  17. # 4. In Powershell, run the following commands:
  18. #
  19. # $ pip install 'virtualenv==20.2.2'
  20. # $ Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
  21. #
  22. # 5. Clone the repository:
  23. #
  24. # $ git clone https://github.com/docker/compose.git
  25. # $ cd compose
  26. #
  27. # 6. Build the binary:
  28. #
  29. # .\script\build\windows.ps1
  30. $ErrorActionPreference = "Stop"
  31. # Remove virtualenv
  32. if (Test-Path venv) {
  33. Remove-Item -Recurse -Force .\venv
  34. }
  35. # Remove .pyc files
  36. Get-ChildItem -Recurse -Include *.pyc | foreach ($_) { Remove-Item $_.FullName }
  37. # Create virtualenv
  38. virtualenv -p C:\Python39\python.exe .\venv
  39. # pip and pyinstaller generate lots of warnings, so we need to ignore them
  40. $ErrorActionPreference = "Continue"
  41. .\venv\Scripts\pip install pypiwin32==223
  42. .\venv\Scripts\pip install -r requirements-indirect.txt
  43. .\venv\Scripts\pip install -r requirements.txt
  44. .\venv\Scripts\pip install --no-deps .
  45. .\venv\Scripts\pip install -r requirements-build.txt
  46. git rev-parse --short HEAD | out-file -encoding ASCII compose\GITSHA
  47. # Build binary
  48. .\venv\Scripts\pyinstaller .\docker-compose.spec
  49. $ErrorActionPreference = "Stop"
  50. Move-Item -Force .\dist\docker-compose.exe .\dist\docker-compose-Windows-x86_64.exe
  51. .\dist\docker-compose-Windows-x86_64.exe --version