Skip to content

Commit 5617e8d

Browse files
raulcdamoeba
andauthored
GH-49676: [Python][Packaging] Fix gRPC docker image layer being too big for hcsshim on Windows (#49678)
### Rationale for this change The docker base docker image which installs all the vcpkg dependencies to build Windows wheels was failing to commit the layer for gRPC due to size. ### What changes are included in this PR? Two separate fixes that independently fix the issue: - Patch vcpkg for Windows to remove unconditional `/Z7` - Use D:/ drive instead of C:/ as it has bigger size for Docker storage ### Are these changes tested? Yes via archery ### Are there any user-facing changes? No * GitHub Issue: #49676 Lead-authored-by: Raúl Cumplido <raulcumplido@gmail.com> Co-authored-by: Bryce Mecum <petridish@gmail.com> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent 35fb62e commit 5617e8d

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

ci/docker/python-wheel-windows-vs2022-base.dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ ENV CMAKE_BUILD_TYPE=${build_type} `
128128
VCPKG_DEFAULT_TRIPLET=amd64-windows-static-md-${build_type} `
129129
VCPKG_FEATURE_FLAGS="manifests"
130130
COPY ci/vcpkg/vcpkg.json arrow/ci/vcpkg/
131+
131132
# cannot use the S3 feature here because while aws-sdk-cpp=1.9.160 contains
132133
# ssl related fixes as well as we can patch the vcpkg portfile to support
133134
# arm machines it hits ARROW-15141 where we would need to fall back to 1.8.186

ci/vcpkg/vcpkg.patch

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
diff --git a/scripts/toolchains/windows.cmake b/scripts/toolchains/windows.cmake
2+
index 3cc90cc..36af495 100644
3+
--- a/scripts/toolchains/windows.cmake
4+
+++ b/scripts/toolchains/windows.cmake
5+
@@ -88,4 +88,4 @@ if(NOT _VCPKG_WINDOWS_TOOLCHAIN)
6+
set(CMAKE_C_FLAGS_DEBUG "${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "")
7+
- set(CMAKE_CXX_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "")
8+
- set(CMAKE_C_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "")
9+
+ set(CMAKE_CXX_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "")
10+
+ set(CMAKE_C_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "")
11+
112
diff --git a/scripts/cmake/vcpkg_execute_build_process.cmake b/scripts/cmake/vcpkg_execute_build_process.cmake
213
index 60fd5b587a..c8dc021af8 100644
314
--- a/scripts/cmake/vcpkg_execute_build_process.cmake

dev/tasks/python-wheels/github.windows.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,28 @@ jobs:
5757
esac
5858
echo "TEST_IMAGE_PREFIX=${test_image_prefix}" >> ${GITHUB_ENV}
5959
60+
- name: Configure Docker data-root
61+
shell: powershell
62+
run: |
63+
# The D: drive on windows-2022 GH Actions runners has ~44GB free vs ~14GB on C:.
64+
# Moving Docker's data-root to D: prevents hcsshim::ImportLayer failures when
65+
# building large Windows container layers (e.g. the vcpkg install layer). GH-49676
66+
Stop-Service docker
67+
$daemonJson = "C:\ProgramData\Docker\config\daemon.json"
68+
New-Item -ItemType Directory -Force -Path (Split-Path $daemonJson) | Out-Null
69+
if (Test-Path $daemonJson) {
70+
$json = Get-Content $daemonJson | ConvertFrom-Json
71+
$json | Add-Member -Force -NotePropertyName "data-root" -NotePropertyValue "D:\docker"
72+
$json | ConvertTo-Json -Depth 10 | Set-Content $daemonJson
73+
} else {
74+
Set-Content $daemonJson -Value '{"data-root":"D:\docker"}'
75+
}
76+
Start-Service docker
77+
Write-Host "=== daemon.json ==="
78+
Get-Content $daemonJson
79+
Write-Host "=== docker info ==="
80+
docker info
81+
6082
- name: Build wheel
6183
shell: cmd
6284
run: |

0 commit comments

Comments
 (0)