1 Star 0 Fork 1

whut-shgm/whut-deliveries-stage2-part1_1

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dockerfile_test.sh 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
whut-shgm 提交于 2022-04-15 20:31 . 测试脚本
#!/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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/whut-shgm/whut-deliveries-stage2-part1_1.git
git@gitee.com:whut-shgm/whut-deliveries-stage2-part1_1.git
whut-shgm
whut-deliveries-stage2-part1_1
whut-deliveries-stage2-part1_1
master

搜索帮助