-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.sh
49 lines (43 loc) · 1.31 KB
/
build.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
#!/bin/bash
dotnet publish ./src/GatewayBranch.Application/GatewayBranch.Application.csproj -c Release -o .output
docker build --pull --rm --no-cache -f "Dockerfile" -t yedajiang44/gatewaybranch "."
while true; do
stty -icanon min 0 time 100
echo -n "是否推送镜像(yes or no)?"
read -r Arg
case $Arg in
Y | y | YES | yes)
break
;;
N | n | NO | no)
exit
;;
"") #Autocontinue
break ;;
esac
done
while true; do
stty -icanon min 0 time 100
echo -n 输入镜像tag:
read -r tag
case $tag in
"") ;;
*)
break
;;
esac
done
echo '准备镜像...'
docker tag yedajiang44/gatewaybranch yedajiang44/gatewaybranch:"$tag"
docker tag yedajiang44/gatewaybranch registry.cn-hangzhou.aliyuncs.com/yedajiang44/gatewaybranch
docker tag yedajiang44/gatewaybranch registry.cn-hangzhou.aliyuncs.com/yedajiang44/gatewaybranch:"$tag"
echo '准备完毕...'
echo '准备推送镜像...'
echo '推送至docker hub...'
docker push yedajiang44/gatewaybranch:"$tag"
docker push yedajiang44/gatewaybranch
echo '推送镜像完毕...'
echo '推送至阿里云...'
docker push registry.cn-hangzhou.aliyuncs.com/yedajiang44/gatewaybranch:"$tag"
docker push registry.cn-hangzhou.aliyuncs.com/yedajiang44/gatewaybranch
echo '推送镜像完毕...'