forked from ZLMediaKit/ZLMediaKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_docker_images.sh
69 lines (63 loc) · 1.47 KB
/
build_docker_images.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -e
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="zlmediakit"
packagename="zlm-mediaserver"
case $type in
'build')
rm -rf ./build/CMakeCache.txt
# 以腾讯云账号为例
docker build --network=host --build-arg MODEL=$model -t ccr.ccs.tencentyun.com/$namespace/$packagename:$model.$version .
;;
'push')
echo "push to dst registry"
# 以腾讯云账号为例
docker login --username=default_name ccr.ccs.tencentyun.com
docker push ccr.ccs.tencentyun.com/$namespace/$packagename:$model.$version
;;
*)
echo "unkonwn type"
echo ".sh [-t build|push] [-m Debug|Release] [-v [version]]"
exit
;;
esac