-
Notifications
You must be signed in to change notification settings - Fork 2
/
img_build.sh
68 lines (58 loc) · 2.6 KB
/
img_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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#echo "export DOCKER_REGISTRY_USER_sdsir=xxx" >> /etc/profile
#echo "export DOCKER_REGISTRY_PW_sdsir=xxx" >> /etc/profile
source /etc/profile
export |grep DOCKER_REG
repo=registry.cn-shenzhen.aliyuncs.com
echo "${DOCKER_REGISTRY_PW_infrastSubUser2}" |docker login --username=${DOCKER_REGISTRY_USER_infrastSubUser2} --password-stdin $repo
ns=infrastlabs
# cache="--no-cache"
# pull="--pull"
ver=v1
cmd="$1"
case "$cmd" in
dict) #./generate >> go源码编译/jqEnv >> 运行时:Clone代码_br-lang2生成dict (entry/gitdiff.sh)
img="lang-replacement:dict" #v1-generate
cd dict; docker build $cache $pull -t $repo/$ns/$img -f Dockerfile .
docker push $repo/$ns/$img
# dind:out-binary ##barge=/mnt/data/
docker run -it --rm --entrypoint=bash -v $barge$(pwd)/generate:/mnt $repo/$ns/$img -c "ls -lh /mnt/; cp -a transfer godiff lang-replacement xml2json /mnt/; ls -lh /mnt/"
;;
cache) #node_modules @v291
img="lang-replacement:cache" #v1-generate
cd output/.cache; docker build $cache $pull -t $repo/$ns/$img -f Dockerfile .
docker push $repo/$ns/$img
;;
replace) ##./replacement/
# Dockerfile
# >> Node环境+lang_placement+node_modules
# >> 运行时: Clone发版的代码, 替换CN, npm构建生成public.tar.gz
img="lang-replacement:replace" #v1-generate
cd replacement; docker build $cache $pull -t $repo/$ns/$img -f Dockerfile.alpine . #cd replacement
docker push $repo/$ns/$img
# tag:replace> latest
img2="lang-replacement:latest"
docker tag $repo/$ns/$img docker push $repo/$ns/$img2
docker push $repo/$ns/$img2
;;
repslim) #replace-slim [node-slim]
img="lang-replacement:replace-slim"
cd replacement; docker build $cache $pull -t $repo/$ns/$img -f Dockerfile . #cd replacement
docker push $repo/$ns/$img
;;
pt) #replace-img 在replace基础上 直接生成汉化版portainer-ce镜像
rq=`date +%Y%m%d |sed "s/^..//"`
img="portainer-cn:v$rq" #-v291
# 改顶层dir构建: 用到./static资源
# cd replacement; docker build $cache $pull -t $repo/$ns/$img -f pt.Dockerfile .
pwd;
docker build $cache $pull -t $repo/$ns/$img -f replacement/pt.Dockerfile .
docker push $repo/$ns/$img
#latest
latest=$repo/$ns/"portainer-cn:latest"
docker tag $repo/$ns/$img $latest
docker push $latest
;;
*)
echo "Please call with a param: [dict, cache,replace,repslim, pt]"
;;
esac