Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. # Copyright 2018 The Go Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style
  3. # license that can be found in the LICENSE file.
  4. MUTABLE_VERSION ?= latest
  5. VERSION ?= $(shell git rev-parse --short HEAD)
  6. IMAGE_NAME=h2demo
  7. docker: Dockerfile
  8. go install golang.org/x/build/cmd/xb
  9. xb docker build -t golang/$(IMAGE_NAME) -f Dockerfile ../..
  10. push-staging: docker
  11. go install golang.org/x/build/cmd/xb
  12. xb --staging docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):$(VERSION)
  13. xb --staging docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):latest
  14. xb --staging docker push REPO/$(IMAGE_NAME):$(VERSION)
  15. xb --staging docker push REPO/$(IMAGE_NAME):latest
  16. push-prod: docker
  17. go install golang.org/x/build/cmd/xb
  18. xb --prod docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):$(VERSION)
  19. xb --prod docker tag golang/$(IMAGE_NAME) REPO/$(IMAGE_NAME):latest
  20. xb --prod docker push REPO/$(IMAGE_NAME):$(VERSION)
  21. xb --prod docker push REPO/$(IMAGE_NAME):latest
  22. # TODO(bradfitz): add REPO subsitution in xb for the kubectl command.
  23. deploy-prod: push-prod
  24. xb --prod kubectl set image deployment/h2demo-deployment h2demo=gcr.io/symbolic-datum-552/h2demo:$(VERSION)
  25. deploy-staging: push-staging
  26. xb --staging kubectl set image deployment/h2demo-deployment h2demo=gcr.io/go-dashboard-dev/h2demo:$(VERSION)
  27. FORCE: