Guest User

Untitled

a guest
Jan 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. # Makefile for building our Docker containers
  2. #
  3. # You can override ARCH and REGISTRY, the default to "amd64 arm arm64 ppc64le s390x" and "miek"
  4. # If you need to get an asset before building use the asset rule. The asset needs to be copied
  5. # to $(arch):
  6. #
  7. # asset:
  8. # cp $(COREDNS)/coredns $(arch)/coredns
  9.  
  10. ifeq (, $(shell which manifest-tool))
  11. $(error No manifest-tool in $$PATH, install with: "go get github.com/estesp/manifest-tool")
  12. endif
  13.  
  14. # Limit architectures we push, full list is: amd64 arm arm64 ppc64le s390x
  15. REGISTRY:=miek
  16.  
  17. ifeq ($(ARCH),)
  18. $(error Please specify architectures use. Full list is "amd64 arm arm64 ppc64le s390x")
  19. endif
  20.  
  21. DIR:=$(shell basename $$PWD)
  22. IMAGE=$(REGISTRY)/$(DIR)
  23. EMPTY:=
  24. SPACE:=$(EMPTY) $(EMPTY)
  25. COMMA:=$(EMPTY),$(EMPTY)
  26. PLATFORMS:=$(subst $(SPACE),$(COMMA),$(foreach arch,$(ARCH),linux/$(arch)))
  27.  
  28. .PHONY: build
  29. build:
  30. for a in $(ARCH); do \
  31. mkdir -p $$a ;\
  32. cp * $$a 2>/dev/null ;\
  33. make arch=$$a asset ;\
  34. ../../bin/dockerfile $$a > $$a/Dockerfile ;\
  35. docker build -t $(IMAGE):$(VERSION) $$a && \
  36. rm -rf $$a ;\
  37. docker tag $(IMAGE):$(VERSION) $(IMAGE)-$$a ;\
  38. docker tag $(IMAGE):$(VERSION) $(IMAGE):latest ;\
  39. done
  40.  
  41. .PHONY: push
  42. push:
  43. for a in $(ARCH); do \
  44. docker push $(IMAGE)-$$a ;\
  45. done
  46. manifest-tool push from-args --platforms $(PLATFORMS) --template $(IMAGE)-ARCH --target $(IMAGE):$(VERSION)
  47. manifest-tool push from-args --platforms $(PLATFORMS) --template $(IMAGE)-ARCH --target $(IMAGE):latest
  48.  
  49. .PHONY: clean
  50. clean:
  51. rm -rf $(ARCH)
  52.  
  53. .PHONY: asset
  54. asset:
Add Comment
Please, Sign In to add comment