Skip to content

Commit

Permalink
app/buildx print_time_cost
Browse files Browse the repository at this point in the history
  • Loading branch information
huapox committed Apr 30, 2024
1 parent 20ffcb8 commit d50228d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/buildx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ echo "${DOCKER_REGISTRY_PW_infrastSubUser2}" |docker login --username=${DOCKER_R
repoHub=docker.io
echo "${DOCKER_REGISTRY_PW_dockerhub}" |docker login --username=${DOCKER_REGISTRY_USER_dockerhub} --password-stdin $repoHub


function print_time_cost(){
local item_name=$1
local begin_time=$2
gawk 'BEGIN{
print "[$item_name]本操作从" strftime("%Y年%m月%d日%H:%M:%S",'$begin_time'),"开始 ,",
strftime("到%Y年%m月%d日%H:%M:%S",systime()) ,"结束,",
" 共历时" systime()-'$begin_time' "秒";
}'
}
function doBuildx(){
local tag=$1
local dockerfile=$2
Expand Down Expand Up @@ -47,6 +55,8 @@ ns=infrastlabs
ver=v51 #base-v5 base-v5-slim
case "$1" in
*)
begin_time="`gawk 'BEGIN{print systime()}'`"
doBuildx "app-$1" src/Dockerfile.*-$1
print_time_cost "app-$1" $begin_time >> /tmp/.timecost
;;
esac

0 comments on commit d50228d

Please sign in to comment.