refactor: 镜像未变化时,升级安装不重复加载镜像文件

This commit is contained in:
xuwei-fit2cloud 2024-01-23 19:08:24 +08:00
parent 44c8d58ead
commit 22522c8a5c

View File

@ -48,6 +48,14 @@ DE_RUN_BASE=$DE_BASE/dataease2.0
conf_folder=${DE_RUN_BASE}/conf conf_folder=${DE_RUN_BASE}/conf
templates_folder=${DE_RUN_BASE}/templates templates_folder=${DE_RUN_BASE}/templates
if [[ $DE_RUN_BASE ]];then
for image in $(grep "image: " $DE_RUN_BASE/docker*.yml | awk -F 'image:' '{print $2}'); do
image_path=$(eval echo $image)
image_name=$(echo $image_path | awk -F "[/]" '{print $3}')
current_images[${#current_images[@]}]=$image_name
done
fi
function prop { function prop {
[ -f "$1" ] | grep -P "^\s*[^#]?${2}=.*$" $1 | cut -d'=' -f2 [ -f "$1" ] | grep -P "^\s*[^#]?${2}=.*$" $1 | cut -d'=' -f2
} }
@ -183,7 +191,11 @@ cd ${CURRENT_DIR}
if [[ -d images ]]; then if [[ -d images ]]; then
log "加载镜像" log "加载镜像"
for i in $(ls images); do for i in $(ls images); do
if [[ "${current_images[@]}" =~ "${i%.tar.gz}" ]]; then
echo "ignore image $i"
else
docker load -i images/$i 2>&1 | tee -a ${CURRENT_DIR}/install.log docker load -i images/$i 2>&1 | tee -a ${CURRENT_DIR}/install.log
fi
done done
else else
DEVERSION=$(cat ${CURRENT_DIR}/dataease/templates/version) DEVERSION=$(cat ${CURRENT_DIR}/dataease/templates/version)