2020-01-14 19:36:36 +08:00
|
|
|
#!/bin/bash
|
2020-04-06 23:52:45 +08:00
|
|
|
set -e
|
2021-09-13 21:16:22 +08:00
|
|
|
while getopts c:t:m:v: opt
|
|
|
|
do
|
|
|
|
case $opt in
|
|
|
|
t)
|
|
|
|
type=$OPTARG
|
|
|
|
;;
|
|
|
|
v)
|
|
|
|
version=$OPTARG
|
|
|
|
;;
|
|
|
|
m)
|
|
|
|
model=$OPTARG
|
|
|
|
;;
|
|
|
|
?)
|
|
|
|
echo "unkonwn"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ ! -n $type ]];then
|
|
|
|
echo ".sh [-t build|push] [-m Debug|Release] [-v [version]]"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -n $model ]];then
|
|
|
|
echo ".sh [-t build|push] [-m Debug|Release] [-v [version]]"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -n $version ]];then
|
|
|
|
echo "use latest no version set"
|
|
|
|
version="latest"
|
|
|
|
fi
|
|
|
|
|
|
|
|
case $model in
|
|
|
|
'Debug')
|
|
|
|
;;
|
|
|
|
'Release')
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unkonwn model"
|
|
|
|
echo ".sh [-t build|push] [-m Debug|Release] [-v [version]]"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-02-23 20:52:33 +08:00
|
|
|
namespace="tannzh"
|
|
|
|
packagename="zlmediakit"
|
2021-09-13 21:16:22 +08:00
|
|
|
|
|
|
|
case $type in
|
|
|
|
'build')
|
|
|
|
rm -rf ./build/CMakeCache.txt
|
|
|
|
# 以腾讯云账号为例
|
2022-02-23 20:52:33 +08:00
|
|
|
docker build --network=host --build-arg MODEL=$model -t $namespace/$packagename:$model.$version .
|
2021-09-13 21:16:22 +08:00
|
|
|
;;
|
|
|
|
'push')
|
|
|
|
echo "push to dst registry"
|
|
|
|
# 以腾讯云账号为例
|
2022-02-23 20:52:33 +08:00
|
|
|
docker login --username=tannzh
|
|
|
|
docker push $namespace/$packagename:$model.$version
|
2021-09-13 21:16:22 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unkonwn type"
|
|
|
|
echo ".sh [-t build|push] [-m Debug|Release] [-v [version]]"
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
esac
|