GNS3 Docker Images
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/sh
  2. #
  3. # build docker images in this repository
  4. #
  5. # usage: build [--no-cache] [image ...]
  6. set -e
  7. DOCKER_BUILD_OPTIONS="--force-rm"
  8. if [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "--help" ]; then
  9. echo "usage: build [--no-cache] [image ...]" >&2
  10. exit 1
  11. fi
  12. docker_build_image() {
  13. path=$1
  14. echo
  15. echo "*** $path"
  16. echo
  17. if [ "$path" = "ipterm" ]; then
  18. docker build $DOCKER_BUILD_OPTIONS -t ehlers/ipterm-base ipterm/base
  19. docker build $DOCKER_BUILD_OPTIONS -t ehlers/ipterm ipterm/cli
  20. docker build $DOCKER_BUILD_OPTIONS -t ehlers/webterm ipterm/web
  21. docker build $DOCKER_BUILD_OPTIONS -t ehlers/web_java ipterm/java
  22. elif [ -f "$path/Dockerfile" ]; then
  23. tag=$(echo "$path" | sed 's/\+/\//')
  24. docker build $DOCKER_BUILD_OPTIONS -t "$tag" "$path"
  25. fi
  26. }
  27. if [ "$1" = "--no-cache" ]; then
  28. DOCKER_BUILD_OPTIONS="${DOCKER_BUILD_OPTIONS} --no-cache"
  29. shift
  30. fi
  31. last_image=$(docker images -q | head -n1)
  32. if [ $# -ge 1 ]; then
  33. for image do
  34. docker_build_image "$image"
  35. done
  36. else
  37. docker_build_image ipterm
  38. for dockerfile in */Dockerfile; do
  39. docker_build_image "$(dirname "$dockerfile")"
  40. done
  41. fi
  42. [ -n "$last_image" ] && filter="--filter since=$last_image" || filter=""
  43. new_images=$(docker images $filter --format '{{.Repository}}:{{.Tag}}' | sort)
  44. dangling=$(docker images -f "dangling=true" -q)
  45. if [ -n "$dangling" ]; then
  46. echo
  47. echo "*** Removing dangling images..."
  48. echo "$dangling" | xargs docker rmi
  49. fi
  50. echo
  51. echo "*** New images:"
  52. if [ -n "$new_images" ]; then
  53. echo "$new_images"
  54. else
  55. echo '--- None ---'
  56. fi