build-docker-image.sh 315 B

12345678910111213141516171819
  1. now=$(date +%Y%m%d)
  2. if [ $# -eq 0 ]; then
  3. echo "镜像名称"
  4. exit 1
  5. fi
  6. tag=$0
  7. if [ $# -eq 1 ]; then
  8. echo "请输入版本号"
  9. exit 1
  10. fi
  11. version=$1
  12. if [ $# -eq 2 ]; then
  13. echo "请输入版本号"
  14. filePath=$2
  15. else
  16. filePath=Dockerfile
  17. fi
  18. docker build -t $tag:$version-$now -f $filePath .