build_and_push.sh 765 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. set -e
  3. natter_check_repo="nattertool/check"
  4. natter_check_ver=$(python3 -Bc 'print(__import__("natter-check").__version__)')
  5. [ "dev" = $(echo "$natter_check_ver" | cut -d- -f2) ] && natter_check_ver="dev"
  6. function tag_natter_check()
  7. {
  8. tag="$1"
  9. new_tags=("${@:2}")
  10. cmd=()
  11. for new_tag in "${new_tags[@]}"; do
  12. cmd+=("-t")
  13. cmd+=("$natter_check_repo:$new_tag")
  14. done
  15. docker buildx imagetools create "${cmd[@]}" "$natter_check_repo:$tag"
  16. }
  17. function build_and_push()
  18. {
  19. docker buildx build --push --tag "$natter_check_repo:dev" --platform linux/amd64,linux/arm64 .
  20. }
  21. function tag_release()
  22. {
  23. tag_natter_check dev "$natter_check_ver" latest
  24. }
  25. build_and_push
  26. if [ "$1" == "release" ]; then
  27. tag_release
  28. fi