Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

build_docker_image.sh 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. print_help() {
  3. echo "Usage: $0 <option>"
  4. echo " full, build full image"
  5. echo " slim, build slim image"
  6. exit 1
  7. }
  8. if [ "$#" -ne 1 ]; then
  9. print_help
  10. fi
  11. docker_version="full"
  12. if [ "$1" == "full" ]; then
  13. docker_version="full"
  14. elif [ "$1" == "slim" ]; then
  15. docker_version="slim"
  16. else
  17. print_help
  18. fi
  19. # update RAGFlow version
  20. # Get the latest tag
  21. last_tag=$(git describe --tags --abbrev=0)
  22. # Get the number of commits from the last tag
  23. commit_count=$(git rev-list --count "$last_tag..HEAD")
  24. # Get the short commit id
  25. last_commit=$(git rev-parse --short HEAD)
  26. version_info=""
  27. if [ "$commit_count" -eq 0 ]; then
  28. version_info=$last_tag
  29. else
  30. printf -v version_info "%s(%s~%d)" "$last_commit" "$last_tag" $commit_count
  31. fi
  32. # Replace the version in the versions.py file
  33. sed -i "s/\"dev\"/\"$version_info\"/" api/versions.py
  34. if [ "$docker_version" == "full" ]; then
  35. docker build -f Dockerfile -t infiniflow/ragflow:dev .
  36. else
  37. docker build -f Dockerfile.slim -t infiniflow/ragflow:dev-slim .
  38. fi
  39. git restore api/versions.py