未验证 提交 91f93640 编写于 作者: haoranc's avatar haoranc 提交者: GitHub

Update dockerbuild.sh

上级 46e80fa3
...@@ -18,8 +18,9 @@ version="" ...@@ -18,8 +18,9 @@ version=""
passWord="" passWord=""
pkgFile="" pkgFile=""
verType="stable" verType="stable"
dockerLatest="n"
while getopts "hc:n:p:f:V:" arg while getopts "hc:n:p:f:V:a:b:" arg
do do
case $arg in case $arg in
c) c)
...@@ -38,17 +39,25 @@ do ...@@ -38,17 +39,25 @@ do
#echo "pkgFile=$OPTARG" #echo "pkgFile=$OPTARG"
pkgFile=$(echo $OPTARG) pkgFile=$(echo $OPTARG)
;; ;;
b)
#echo "branchName=$OPTARG"
branchName=$(echo $OPTARG)
;;
V) V)
#echo "verType=$OPTARG" #echo "verType=$OPTARG"
verType=$(echo $OPTARG) verType=$(echo $OPTARG)
;; ;;
a)
#echo "dockerLatest=$OPTARG"
dockerLatest=$(echo $OPTARG)
;;
h) h)
echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] " echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] "
echo " -n [version number] " echo " -n [version number] "
echo " -p [password for docker hub] " echo " -p [password for docker hub] "
echo " -V [stable | beta] " echo " -V [stable | beta] "
echo " -f [pkg file] " echo " -f [pkg file] "
echo " -a [y | n ] "
exit 0 exit 0
;; ;;
?) #unknow option ?) #unknow option
...@@ -58,13 +67,11 @@ do ...@@ -58,13 +67,11 @@ do
esac esac
done done
# if [ "$verType" == "beta" ]; then
# pkgFile=TDengine-server-${version}-Linux-${cpuType}-${verType}.tar.gz # Check_verison()
# elif [ "$verType" == "stable" ]; then # {
# pkgFile=TDengine-server-${version}-Linux-${cpuType}.tar.gz # }
# else
# echo "unknow verType, nor stabel or beta"
# exit 1
if [ "$verType" == "beta" ]; then if [ "$verType" == "beta" ]; then
dockername=${cpuType}-${verType} dockername=${cpuType}-${verType}
...@@ -84,6 +91,9 @@ echo "====NOTES: ${pkgFile} must be in the same directory as dockerbuild.sh====" ...@@ -84,6 +91,9 @@ echo "====NOTES: ${pkgFile} must be in the same directory as dockerbuild.sh===="
scriptDir=$(dirname $(readlink -f $0)) scriptDir=$(dirname $(readlink -f $0))
comunityArchiveDir=/nas/TDengine/v$version/community # community version’package directory comunityArchiveDir=/nas/TDengine/v$version/community # community version’package directory
communityDir=${scriptDir}/../../../community
DockerfilePath=${communityDir}/packaging/docker/
Dockerfile=${communityDir}/packaging/docker/Dockerfile
cd ${scriptDir} cd ${scriptDir}
cp -f ${comunityArchiveDir}/${pkgFile} . cp -f ${comunityArchiveDir}/${pkgFile} .
...@@ -100,13 +110,65 @@ else ...@@ -100,13 +110,65 @@ else
exit 1 exit 1
fi fi
docker build --rm -f "Dockerfile" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias} docker build --rm -f "${Dockerfile}" --network=host -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName} --build-arg cpuType=${cpuTypeAlias}
docker login -u tdengine -p ${passWord} #replace the docker registry username and password docker login -u tdengine -p ${passWord} #replace the docker registry username and password
docker push tdengine/tdengine-${dockername}:${version} docker push tdengine/tdengine-${dockername}:${version}
# set this version to latest version if [ -n "$(docker ps -aq)" ] ;then
docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest echo "delte docker process"
docker push tdengine/tdengine-${dockername}:latest docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
fi
if [ -n "$(pidof taosd)" ] ;then
echo "kill taosd "
kill -9 $(pidof taosd)
fi
if [ -n "$(pidof power)" ] ;then
echo "kill power "
kill -9 $(pidof power)
fi
echo ">>>>>>>>>>>>> check whether tdengine/tdengine-${dockername}:${version} has been published"
docker run -d --name doctest -p 6030-6049:6030-6049 -p 6030-6049:6030-6049/udp tdengine/tdengine-${dockername}:${version}
sleep 2
curl -u root:taosdata -d 'show variables;' 127.0.0.1:6041/rest/sql > temp1.data
data_version=$( cat temp1.data |jq .data| jq '.[]' |grep "version" -A 2 -B 1 | jq ".[1]")
echo "${data_version}"
if [ "${data_version}" == "\"${version}\"" ] ; then
echo "docker version is right "
else
echo "docker version is wrong "
exit 1
fi
rm -rf temp1.data
# set this version to latest version
if [ ${dockerLatest} == 'y' ] ;then
docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest
docker push tdengine/tdengine-${dockername}:latest
echo ">>>>>>>>>>>>> check whether tdengine/tdengine-${dockername}:latest has been published correctly"
docker run -d --name doctestla -p 7030-7049:6030-6049 -p 7030-7049:6030-6049/udp tdengine/tdengine-${dockername}:latest
sleep 2
curl -u root:taosdata -d 'show variables;' 127.0.0.1:7041/rest/sql > temp2.data
version_latest=` cat temp2.data |jq .data| jq '.[]' |grep "version" -A 2 -B 1 | jq ".[1]" `
echo "${version_latest}"
if [ "${version_latest}" == "\"${version}\"" ] ; then
echo "docker version is right "
else
echo "docker version is wrong "
exit 1
fi
fi
rm -rf temp2.data
if [ -n "$(docker ps -aq)" ] ;then
echo "delte docker process"
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
fi
cd ${scriptDir}
rm -f ${pkgFile} rm -f ${pkgFile}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册