#!/bin/bash set -e tag=$1 if [ -n "$tag" ] then echo "当前镜像tag: $tag" else echo "请输入当前镜像tag" exit fi ### go testing # echo "============ go test start ================" # make ci-test # echo "============ go test end ================" ### go build echo "============ go build start ================" make build version=${tag} echo "============ go build end ================" echo "============push images start================" export aliYunDockerDNS=registry.cn-hangzhou.aliyuncs.com export aliYunDockerUsername=kptzhu@163.com export aliYunDockerPassword=zhuz1898 export images=kpt-event/kpt-tmr docker build -t ${images}:${tag} -f ./Dockerfile . docker login ${aliYunDockerDNS} --username ${aliYunDockerUsername} --password ${aliYunDockerPassword} docker tag ${images}:${tag} ${aliYunDockerDNS}/${images}:${tag} docker tag ${images}:${tag} ${aliYunDockerDNS}/${images}:latest docker push ${aliYunDockerDNS}/${images}:${tag} docker push ${aliYunDockerDNS}/${images}:latest docker rmi ${images}:${tag} ${aliYunDockerDNS}/${images}:${tag} ${aliYunDockerDNS}/${images}:latest echo "============push images end ================"