#!/bin/bash # 编译应用 echo "building..." go build -o box-cost-service # 命名镜像 local_imge="pack-box-cost:v1.0.5" repository_image="registry.cn-chengdu.aliyuncs.com/infish/pack-box-cost:v1.0.5" # 删除本地已存在的镜像 docker rmi $repository_image # 创建本地镜像 docker build -t $local_imge . # 镜像标签 docker tag $local_imge $repository_image # push到镜像仓库,需要登陆对应docker仓库账号 docker push $repository_image # 删除编译的文件 rm -rf box-cost-service # 运行示例 # docker run -itd -p 20001:20001 --name comm-pay-service pay-service:1.0.0