diff --git a/docker/build.sh b/docker/build.sh index 75f0e35c6c7b..123365c8f0a0 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -25,11 +25,15 @@ # [--net=host] [--cache-from ] [--cache] # [--name CONTAINER_NAME] [--context-path ] # [--spec DOCKER_IMAGE_SPEC] +# [--platform ] # [] # # CONTAINER_TYPE: Type of the docker container used the run the build, # e.g. "ci_cpu", "ci_gpu" # +# BUILD_PLATFORM: (Optional) Type of build platform used for the build, +# e.g. "arm", "cpu", "gpu". Defaults to "cpu". +# # DOCKER_IMAGE_TAG: (Optional) Docker image tag to be built and used. # Defaults to 'latest', as it is the default Docker tag. # @@ -119,6 +123,14 @@ if [[ "$1" == "--name" ]]; then shift 2 fi +PLATFORM="cpu" + +if [[ "$1" == "--platform" ]]; then + PLATFORM="$2" + echo "Using build platform: ${PLATFORM}" + shift 2 +fi + if [[ ! -f "${DOCKERFILE_PATH}" ]]; then echo "Invalid Dockerfile path: \"${DOCKERFILE_PATH}\"" exit 1 @@ -227,6 +239,7 @@ if [[ -n ${COMMAND} ]]; then -e "CI_BUILD_GID=$(id -g)" \ -e "CI_PYTEST_ADD_OPTIONS=$CI_PYTEST_ADD_OPTIONS" \ -e "CI_IMAGE_NAME=${DOCKER_IMAGE_NAME}" \ + -e "PLATFORM=${PLATFORM}" \ ${CUDA_ENV}\ ${CI_DOCKER_EXTRA_PARAMS[@]} \ ${DOCKER_IMG_SPEC} \