ZLMediaKit/build_docker_images.sh

70 lines
1.4 KiB
Bash
Raw Normal View History

#!/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
namespace="tannzh"
packagename="zlmediakit"
2021-09-13 21:16:22 +08:00
case $type in
'build')
rm -rf ./build/CMakeCache.txt
# 以腾讯云账号为例
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"
# 以腾讯云账号为例
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