#!/bin/bash # 이미지 리스트 images_list="/Users/byeonjunghun/Documents/git/script/imageslist" # repo nexus="10.10.31.243:5000" dkrepo="exemdev2" localrepo="10.10.43.230:5000" # release version repo=$1 version=rel$2 nexus() { # images pull & tag & push nexus clear while IFS= read -r image_name; do echo -e "\n\n\033[93m ${image_name}:${version} pulling!\n\n\033[0m" docker pull ${nexus}/cmoa/${image_name}:${version} done <"${images_list}" while IFS= read -r image_name; do docker tag ${nexus}/cmoa/${image_name}:${version} ${nexus}/cmoa3/${image_name}:${version} done <"${images_list}" clear while IFS= read -r image_name; do echo -e "\n\n\033[93 ${image_name}:${version} push!\n\n\033[0m" docker push ${nexus}/cmoa3/${image_name}:${version} done <"${images_list}" } dockerhub() { # images pull & tag & push nexus clear while IFS= read -r image_name; do echo -e "\n\033[93m ${image_name}:${version} pulling!\n\033[0m" docker pull ${nexus}/cmoa/${image_name}:${version} done <"${images_list}" while IFS= read -r image_name; do docker tag ${nexus}/cmoa/${image_name}:${version} ${dkrepo}/${image_name}:${version} done <"${images_list}" clear while IFS= read -r image_name; do echo -e "\n\033[93 ${image_name}:${version} push!\n\033[0m" docker push ${dkrepo}/${image_name}:${version} done <"${images_list}" } local() { # images pull & tag & push nexus clear while IFS= read -r image_name; do echo -e "\n\n\033[93m ${image_name}:${version} pulling!\n\n\033[0m" docker pull ${nexus}/cmoa/${image_name}:${version} done <"${images_list}" while IFS= read -r image_name; do docker tag ${nexus}/cmoa/${image_name}:${version} ${localrepo}/cmoa3/${image_name}:${version} done <"${images_list}" clear while IFS= read -r image_name; do echo -e "\n\n\033[93 ${image_name}:${version} push!\n\n\033[0m" docker push ${localrepo}/cmoa3/${image_name}:${version} done <"${images_list}" } main(){ if [ "${repo}" = "nexus" ] then nexus elif [ "${repo}" = "docker" ] then dockerhub elif [ "${repo}" = "local" ] then local elif [ "${repo}" != "nexus" ] && [ "${repo}" != "docker" ] then echo -e "\n\033[93m./rel.sh nexus version\033[0m" echo -e "\033[93m./rel.sh docker version\033[0m" echo -e "\033[93m./rel.sh local version\033[0m" fi } main