onnxruntime/tools/ci_build/github/linux/run_python_dockerbuild.sh
Yifan Li 91fb865058
[ORT 1.18.1 Release] Cherry pick 1st round (#21105)
### Description
<!-- Describe your changes. -->



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->

---------

Co-authored-by: Jian Chen <cjian@microsoft.com>
Co-authored-by: Yi Zhang <zhanyi@microsoft.com>
Co-authored-by: Changming Sun <chasun@microsoft.com>
Co-authored-by: Ye Wang <52801275+wangyems@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
2024-06-19 22:10:58 -05:00

42 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
set -e -x
BUILD_CONFIG="Release"
while getopts "i:d:x:c:" parameter_Option
do case "${parameter_Option}"
in
i) DOCKER_IMAGE=${OPTARG};;
d) DEVICE=${OPTARG};;
x) BUILD_EXTR_PAR=${OPTARG};;
c) BUILD_CONFIG=${OPTARG};;
*) echo "Usage: $0 -i <docker_image> -d <GPU|CPU> [-x <extra_build_arg>] [-c <build_config>]"
exit 1;;
esac
done
mkdir -p "${HOME}/.onnx"
DOCKER_SCRIPT_OPTIONS="-d ${DEVICE} -c ${BUILD_CONFIG}"
if [ "${BUILD_EXTR_PAR}" != "" ] ; then
DOCKER_SCRIPT_OPTIONS+=" -x ${BUILD_EXTR_PAR}"
fi
docker run --rm \
--volume /data/onnx:/data/onnx:ro \
--volume "${BUILD_SOURCESDIRECTORY}:/onnxruntime_src" \
--volume "${BUILD_BINARIESDIRECTORY}:/build" \
--volume /data/models:/build/models:ro \
--volume "${HOME}/.onnx:/home/onnxruntimedev/.onnx" \
-w /onnxruntime_src \
-e NIGHTLY_BUILD \
-e BUILD_BUILDNUMBER \
-e ORT_DISABLE_PYTHON_PACKAGE_LOCAL_VERSION \
-e DEFAULT_TRAINING_PACKAGE_DEVICE \
$ADDITIONAL_DOCKER_PARAMETER \
$DOCKER_IMAGE tools/ci_build/github/linux/build_linux_python_package.sh $DOCKER_SCRIPT_OPTIONS
sudo rm -rf "${BUILD_BINARIESDIRECTORY}/${BUILD_CONFIG}/onnxruntime" "${BUILD_BINARIESDIRECTORY}/${BUILD_CONFIG}/pybind11" \
"${BUILD_BINARIESDIRECTORY}/${BUILD_CONFIG}/models" "${BUILD_BINARIESDIRECTORY}/${BUILD_CONFIG}/_deps" \
"${BUILD_BINARIESDIRECTORY}/${BUILD_CONFIG}/CMakeFiles"
cd "${BUILD_BINARIESDIRECTORY}/${BUILD_CONFIG}"
find -executable -type f > "${BUILD_BINARIESDIRECTORY}/${BUILD_CONFIG}/perms.txt"