github.com/technosophos/deis@v1.7.1-0.20150915173815-f9005256004b/router/Makefile (about)

     1  include ../includes.mk
     2  
     3  # the filepath to this repository, relative to $GOPATH/src
     4  repo_path = github.com/deis/deis/router
     5  
     6  GO_FILES = $(wildcard *.go)
     7  GO_PACKAGES = cmd/boot logger tests
     8  GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES))
     9  
    10  SHELL_SCRIPTS = $(shell find "." -name '*.sh') $(wildcard rootfs/bin/*)
    11  
    12  COMPONENT = $(notdir $(repo_path))
    13  IMAGE = $(IMAGE_PREFIX)$(COMPONENT):$(BUILD_TAG)
    14  DEV_IMAGE = $(REGISTRY)$(IMAGE)
    15  BUILD_IMAGE = $(COMPONENT)-build
    16  BINARY_DEST_DIR = rootfs/bin
    17  
    18  build: check-docker
    19  	GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix -v -ldflags '-s' -o $(BINARY_DEST_DIR)/boot cmd/boot/boot.go || exit 1
    20  	@$(call check-static-binary,rootfs/bin/boot)
    21  	docker build -t $(IMAGE) .
    22  	rm rootfs/bin/boot
    23  
    24  clean: check-docker check-registry
    25  	docker rmi $(IMAGE)
    26  
    27  full-clean: check-docker check-registry
    28  	docker images -q $(IMAGE_PREFIX)$(COMPONENT) | xargs docker rmi -f
    29  
    30  install: check-deisctl
    31  	deisctl scale $(COMPONENT)=3
    32  
    33  uninstall: check-deisctl
    34  	deisctl scale $(COMPONENT)=0
    35  
    36  start: check-deisctl
    37  	deisctl start $(COMPONENT)@*
    38  
    39  stop: check-deisctl
    40  	deisctl stop $(COMPONENT)@*
    41  
    42  restart: stop start
    43  
    44  run: install start
    45  
    46  dev-release: push set-image
    47  
    48  push: check-registry
    49  	docker tag -f $(IMAGE) $(DEV_IMAGE)
    50  	docker push $(DEV_IMAGE)
    51  
    52  set-image: check-deisctl
    53  	deisctl config $(COMPONENT) set image=$(DEV_IMAGE)
    54  
    55  release:
    56  	docker push $(IMAGE)
    57  
    58  deploy: build dev-release restart
    59  
    60  test: test-style test-unit test-functional
    61  
    62  test-functional:
    63  	@$(MAKE) -C ../tests/ test-etcd
    64  	GOPATH=`cd ../tests/ && godep path`:$(GOPATH) go test -v ./tests/...
    65  
    66  test-style:
    67  # display output, then check
    68  	$(GOFMT) $(GO_PACKAGES) $(GO_FILES)
    69  	@$(GOFMT) $(GO_PACKAGES) $(GO_FILES) | read; if [ $$? == 0 ]; then echo "gofmt check failed."; exit 1; fi
    70  	$(GOVET) $(GO_PACKAGES_REPO_PATH)
    71  	$(GOLINT) ./...
    72  	shellcheck $(SHELL_SCRIPTS)
    73  
    74  test-unit:
    75  	@echo no unit tests