|
78 | 78 | Memory and CPU limits only apply to hyperv isolation. |
79 | 79 |
|
80 | 80 | .PARAMETER Memory |
81 | | - Docker memory limit (e.g., "8g"). Only used with hyperv isolation. Defaults to 24g. |
| 81 | + Docker memory limit (e.g., "8g"). Only used with hyperv isolation. |
| 82 | + Defaults to $env:BuildAgentMemory (an integer in GB) if set, otherwise 24g. |
82 | 83 |
|
83 | 84 | .PARAMETER Cpus |
84 | | - Docker CPU limit. Defaults to the host processor count. Only used with hyperv isolation. |
| 85 | + Docker CPU limit. Only used with hyperv isolation. |
| 86 | + Defaults to $env:BuildAgentCpus if set, otherwise the host processor count. |
85 | 87 |
|
86 | 88 | .PARAMETER Mount |
87 | 89 | Additional directories to mount from the host (readonly by default, append :w for writable). |
@@ -143,8 +145,8 @@ param( |
143 | 145 | [string]$RegistryImage, # Use a pre-built image from a registry, skipping Dockerfile build entirely. |
144 | 146 | [switch]$NoInit, # Do not generate or call Init.g.ps1 (skips git config, safe.directory, etc). |
145 | 147 | [string]$Isolation = 'hyperv', # Docker isolation mode (process or hyperv). Memory/CPU limits only apply to hyperv. |
146 | | - [string]$Memory = '24g', # Docker memory limit (e.g., "8g"). Only used with hyperv isolation. |
147 | | - [int]$Cpus = [Environment]::ProcessorCount, # Docker CPU limit. Only used with hyperv isolation. |
| 148 | + [string]$Memory = $(if ($env:BuildAgentMemory) { "${env:BuildAgentMemory}g" } else { '24g' }), # Docker memory limit (e.g., "8g"). Only used with hyperv isolation. Defaults to $env:BuildAgentMemory (in GB) or 24g. |
| 149 | + [int]$Cpus = $(if ($env:BuildAgentCpus) { [int]$env:BuildAgentCpus } else { [Environment]::ProcessorCount }), # Docker CPU limit. Only used with hyperv isolation. Defaults to $env:BuildAgentCpus or host processor count. |
148 | 150 | [string[]]$Mount, # Additional directories to mount from host (readonly by default, append :w for writable). Supports * and ** glob patterns. |
149 | 151 | [string[]]$Env, # Additional environment variables to pass from host to container. |
150 | 152 | [string[]]$Ports, # Port mappings from host to container (e.g., "8080:80", "3000"). |
|
0 commit comments