client_build.sh 792 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env bash
  2. registry_host="ccr.ccs.tencentyun.com/wanpinghui"
  3. project_name="go-example-client"
  4. exec_name="go-example"
  5. rm -rf ./bin
  6. mkdir -p ./bin
  7. #cp ../tls/*.crt ./bin/
  8. GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s" -v -o ./bin/$exec_name ../client/simple_client.go
  9. for item in $(docker images | grep -E "$registry_host/$project_name\s+\S*" -o);
  10. do
  11. if [[ $item != "$registry_host/$project_name" ]];
  12. then
  13. echo "remove $registry_host/$project_name:$item"
  14. docker rmi "$registry_host/$project_name:$item"
  15. fi
  16. done
  17. tag=$(date +%s)
  18. docker login -u=100010573203 ccr.ccs.tencentyun.com -p=wanpinghui151217
  19. docker build --no-cache --disable-content-trust=true -t $registry_host/$project_name:$tag .
  20. docker push $registry_host/$project_name:$tag