dockerManifest.sh 3.5 KB
Newer Older
1 2 3 4 5 6 7
#!/bin/bash
set -e
#set -x

# dockerbuild.sh 
#             -n [version number]
#             -p [xxxx]
haoranc's avatar
haoranc 已提交
8
#             -V [stable | beta]
9 10

# set parameters by default value
haoranc's avatar
haoranc 已提交
11
version=""
12
passWord=""
haoranc's avatar
haoranc 已提交
13
verType=""
14

haoranc's avatar
haoranc 已提交
15
while getopts "hn:p:V:" arg
16 17 18
do
  case $arg in
    n)
haoranc's avatar
haoranc 已提交
19 20
      #echo "version=$OPTARG"
      version=$(echo $OPTARG)
21 22 23 24 25
      ;;
    p)
      #echo "passWord=$OPTARG"
      passWord=$(echo $OPTARG)
      ;;
haoranc's avatar
haoranc 已提交
26 27 28 29
    V)
      #echo "verType=$OPTARG"
      verType=$(echo $OPTARG)
      ;;    
30 31 32 33 34 35 36 37 38 39 40 41
    h)
      echo "Usage: `basename $0` -n [version number] "
      echo "                      -p [password for docker hub] "
      exit 0
      ;;
    ?) #unknow option 
      echo "unkonw argument"
      exit 1
      ;;
  esac
done

haoranc's avatar
haoranc 已提交
42
echo "version=${version}"
43

B
bryanchang0603 已提交
44
#docker manifest rm tdengine/tdengine
haoranc's avatar
haoranc 已提交
45 46
#docker manifest rm tdengine/tdengine:${version}
if [ "$verType" == "beta" ]; then
haoranc's avatar
haoranc 已提交
47
  docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
haoranc's avatar
haoranc 已提交
48
  docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
haoranc's avatar
haoranc 已提交
49
  docker manifest rm tdengine/tdengine-beta:${version}
haoranc's avatar
haoranc 已提交
50
  docker manifest rm tdengine/tdengine-beta:latest
haoranc's avatar
haoranc 已提交
51 52
  docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
  docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
haoranc's avatar
haoranc 已提交
53 54
  docker manifest inspect  tdengine/tdengine:latest 
  docker manifest inspect  tdengine/tdengine:${version}
haoranc's avatar
haoranc 已提交
55
  docker login -u tdengine -p ${passWord}  #replace the docker registry username and password
haoranc's avatar
haoranc 已提交
56
  docker manifest push tdengine/tdengine-beta:${version}
haoranc's avatar
haoranc 已提交
57
  docker manifest push tdengine/tdengine-beta:latest
haoranc's avatar
haoranc 已提交
58
elif [ "$verType" == "stable" ]; then
haoranc's avatar
haoranc 已提交
59
  docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
haoranc's avatar
haoranc 已提交
60
  docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
haoranc's avatar
haoranc 已提交
61
  docker manifest rm tdengine/tdengine:latest
haoranc's avatar
haoranc 已提交
62
  docker manifest rm tdengine/tdengine:${version}
haoranc's avatar
haoranc 已提交
63 64
  docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
  docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
haoranc's avatar
haoranc 已提交
65 66
  docker manifest inspect  tdengine/tdengine:latest 
  docker manifest inspect  tdengine/tdengine:${version}
haoranc's avatar
haoranc 已提交
67
  docker login -u tdengine -p ${passWord}  #replace the docker registry username and password
haoranc's avatar
haoranc 已提交
68
  docker manifest push tdengine/tdengine:${version}
haoranc's avatar
haoranc 已提交
69
  docker manifest push tdengine/tdengine:latest
haoranc's avatar
haoranc 已提交
70 71 72 73
else
  echo "unknow verType, nor stabel or beta"
  exit 1
fi
74

haoranc's avatar
haoranc 已提交
75 76
# docker manifest create -a tdengine/${dockername}:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
# docker manifest create -a tdengine/${dockername}:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
77

haoranc's avatar
haoranc 已提交
78
# docker login -u tdengine -p ${passWord}  #replace the docker registry username and password
79

haoranc's avatar
haoranc 已提交
80 81 82
# docker manifest push tdengine/tdengine:latest

# # how set latest version ???