build.sh 619 B

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