build_pipeline.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/usr/bin/env bash
  2. build_for_offline='false'
  3. paddleocr_version='>=3.3.2,<3.4'
  4. tag_suffix='latest'
  5. dockerfile=pipeline.Dockerfile
  6. while [[ $# -gt 0 ]]; do
  7. case $1 in
  8. --device-type)
  9. [ -z "$2" ] && {
  10. echo "`--device-type` requires a value" >&2
  11. exit 2
  12. }
  13. device_type="$2"
  14. shift
  15. shift
  16. case "${device_type}" in
  17. gpu|gpu-sm120|dcu|xpu|metax-gpu)
  18. ;;
  19. *)
  20. echo "Unknown device type: ${device_type}" >&2
  21. exit 2
  22. ;;
  23. esac
  24. ;;
  25. --offline)
  26. build_for_offline='true'
  27. shift
  28. ;;
  29. --ppocr-version)
  30. [ -z "$2" ] && {
  31. echo "`--ppocr-version` requires a value" >&2
  32. exit 2
  33. }
  34. paddleocr_version="==$2"
  35. shift
  36. shift
  37. ;;
  38. --tag-suffix)
  39. [ -z "$2" ] && {
  40. echo "`--tag-suffix` requires a value" >&2
  41. exit 2
  42. }
  43. tag_suffix="$2"
  44. shift
  45. shift
  46. ;;
  47. *)
  48. echo "Unknown option: $1" >&2
  49. exit 2
  50. ;;
  51. esac
  52. done
  53. if [ "${device_type}" != 'gpu' ]; then
  54. tag_suffix="${tag_suffix}-${device_type}"
  55. fi
  56. if [ "${build_for_offline}" = 'true' ]; then
  57. tag_suffix="${tag_suffix}-offline"
  58. fi
  59. dockerfile="accelerators/${device_type}/pipeline.Dockerfile"
  60. docker build \
  61. -f "${dockerfile}" \
  62. -t "ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlepaddle/paddleocr-vl:${tag_suffix}" \
  63. --build-arg BUILD_FOR_OFFLINE="${build_for_offline}" \
  64. --build-arg PADDLEOCR_VERSION="${paddleocr_version}" \
  65. --build-arg http_proxy="${http_proxy}" \
  66. --build-arg https_proxy="${https_proxy}" \
  67. --build-arg no_proxy="${no_proxy}" \
  68. .