代码拉取完成,页面将自动刷新
#!/bin/sh
docker_build()
{
if [ "$1" == "centos" ]; then
docker_path=$(find "/root/t/whut-huawei-deliveries/$1_$2/" -type f -name "*Dockerfile*" | xargs grep -HE \
-e '^FROM centos$' \
-e '^FROM centos:latest$' \
-e '^FROM centos:(centos|)[78]$')
elif [ "$1" == "openeuler" ]; then
if [ "$2" == "aarch64" ];then
docker_path=$(find "/root/$3" -type f -name "*Dockerfile*" | xargs grep "FROM openeuler:20.03-LTS-SP1-ALL-DNF$")
elif [ "$2" == "x86" ]; then
docker_path=$(find "/root/t/whut-huawei-deliveries/openeuler_x86/" -type f -name "*Dockerfile*" | xargs grep -HE -e '^FROM openeuler/openeuler:20.03-lts-sp1$' -e '^FROM lsqtzj/openeuler_httpd$')
fi
fi
docker_path=$(echo ${docker_path} | sed 's/FROM /FROM@/g')
local n=0
for file in ${docker_path}
do
n=$(($n + 1))
echo ${file}
file1=${file%%:*}
file2=${file1%/*}
cd ${file2}
echo "***${n}****"
docker build -t $n -f ${file1} .
if [ $? = 0 ];then
echo "success: ${file1}"
else
echo "fail: ${file1}"
fi
docker rmi $n:latest -f
done
}
result_log()
{
for repo in $(ls -l | grep "^d" | awk '{print $NF}')
do
#echo $repo
success_path=$(grep "$repo" log | grep "success: ")
fail_path=$(grep "$repo" log | grep "fail: /")
success_num=$(grep "$repo" log | grep "success: " | wc -l)
fail_number=$(grep "$repo" log | grep "fail: /"| wc -l)
echo "$success_path" >> result
[[ -n $fail_path ]] && echo "$fail_path" >> result
echo "$repo: success_num: $success_num fail_num: $fail_number" >> result
echo "====================" >> result
done
}
docker_build "$1" "$2" "$3"
#result_log
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。