21 if [[ ${NAME} && ${VERSION} && ${DIR} ]]; then
22 echo "assign the x to all files and dirs under current dir.."
24 echo "begin to build image ${NAME}.."
25 docker build --no-cache -t ${NAME}:${VERSION} . >/dev/null || { echo -e "\nBuild docker image failed!";exit 1; }
26 docker rmi $(docker images | grep "^<none>" | awk '{print $3}') &>/dev/null
27 # docker save -o ${NAME}.tar ${NAME}:${VERSION} >/dev/null || { rm -f ${NAME}.tar &>/dev/null;echo -e "\nSave docker image failed!";exit 1; }
28 # if [ ! -d ${DIR} ]; then
31 # mv ${NAME}.tar ${DIR}/${NAME}.tar &>/dev/null
32 echo "build completes!"
34 echo "not all -n and -v and -d are provided!"