forked from rapidsai/cibuildwheel-imgs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·58 lines (47 loc) · 1.71 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
set -eou pipefail
set -x
image_to_build="${BUILD_IMAGE:-""}"
if [[ "${image_to_build}" == "" ]]; then
echo "Must specify BUILD_IMAGE" >&2
exit 1
fi
# chop it up for informational purposes
img=$(echo "${image_to_build}" | tr "/:" "-")
cuda_variant=$(echo "${img}" | cut -d'-' -f3)
jetson="no"
if [[ "${cuda_variant}" == *"l4t"* ]]; then
jetson="yes"
fi
img_type=$(echo "${img}" | cut -d'-' -f2)
cuda_type=$(echo "${img}" | cut -d'-' -f4)
cuda_ver=$(echo "${img}" | cut -d'-' -f5)
os=$(echo "${img}" | cut -d'-' -f6)
arch=$(echo "${img}" | cut -d'-' -f7)
real_arch=$(uname -m)
if [[ ("$arch" != "$real_arch") ]]; then
echo "Image arch '${arch}' doesn't match runner arch '${real_arch}'" >&2
exit 1
fi
cpu_arch=""
if [[ "$real_arch" == "x86_64" ]]; then
cpu_arch="amd64"
elif [[ "$real_arch" == "aarch64" ]]; then
cpu_arch="arm64"
fi
base_image="nvidia/cuda:${cuda_ver}-${cuda_type}-${os}"
case $img_type in
"citestwheel")
docker build --build-arg CPU_ARCH="${cpu_arch}" --build-arg BASE_IMAGE="${base_image}" --pull ./ciwheel -t "${image_to_build}" >&2
;;
"manylinux_v2"*)
if [[ ("$os" == *"centos"*) ]]; then
docker build --build-arg CPU_ARCH="${cpu_arch}" --build-arg BASE_IMAGE="${base_image}" --pull ./manylinux_v2_centos -t "${image_to_build}" >&2
else
docker build --build-arg CPU_ARCH="${cpu_arch}" --build-arg BASE_IMAGE="${base_image}" --pull ./manylinux_v2_ubuntu -t "${image_to_build}" >&2
fi
;;
*)
echo "Unsupported image build '$img_type'" >&2
exit 1
esac