github.com/econnell/deis@v1.5.1/logspout/Makefile (about)

     1  include ../includes.mk
     2  
     3  # the filepath to this repository, relative to $GOPATH/src
     4  repo_path = github.com/deis/deis/logspout
     5  
     6  GO_FILES = attacher.go logspout.go routes.go types.go
     7  GO_PACKAGES = utils
     8  GO_PACKAGES_REPO_PATH = $(addprefix $(repo_path)/,$(GO_PACKAGES))
     9  
    10  COMPONENT = $(notdir $(repo_path))
    11  DOCKER_IMAGE := deis/$(COMPONENT)
    12  RELEASE_IMAGE := $(DOCKER_IMAGE):$(BUILD_TAG)
    13  DEV_DOCKER_IMAGE := $(DEV_REGISTRY)/$(RELEASE_IMAGE)
    14  
    15  build: check-docker
    16  	GOOS=linux GOARCH=amd64 CGO_ENABLED=0 godep go build -a -installsuffix cgo -ldflags '-s' -o image/logspout
    17  	$(call check-static-binary,image/logspout)
    18  	docker build -t $(RELEASE_IMAGE) image
    19  
    20  clean:
    21  	rm -rf image/logspout
    22  
    23  full-clean:
    24  	docker images -q $(DOCKER_IMAGE) | xargs docker rmi -f
    25  	docker images -q $(DEV_DOCKER_IMAGE) | xargs docker rmi -f
    26  	docker images -q $(RELEASE_IMAGE) | xargs docker rmi -f
    27  
    28  install: check-deisctl
    29  	deisctl install $(COMPONENT)
    30  
    31  uninstall: check-deisctl
    32  	deisctl uninstall $(COMPONENT)
    33  
    34  start: check-deisctl
    35  	deisctl start $(COMPONENT)
    36  
    37  stop: check-deisctl
    38  	deisctl stop $(COMPONENT)
    39  
    40  restart: stop start
    41  
    42  run: install start
    43  
    44  dev-release: push set-image
    45  
    46  push: check-registry
    47  	docker tag -f $(RELEASE_IMAGE) $(DEV_DOCKER_IMAGE)
    48  	docker push $(DEV_DOCKER_IMAGE)
    49  
    50  set-image: check-deisctl
    51  	deisctl config $(COMPONENT) set image=$(DEV_DOCKER_IMAGE)
    52  
    53  release:
    54  	docker push $(RELEASE_IMAGE)
    55  
    56  deploy: build dev-release restart
    57  
    58  setup-root-gotools:
    59  	sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/cover
    60  	sudo GOPATH=/tmp/tmpGOPATH go get -u -v code.google.com/p/go.tools/cmd/vet
    61  	sudo rm -rf /tmp/tmpGOPATH
    62  
    63  setup-gotools:
    64  	go get -v github.com/golang/lint/golint
    65  
    66  test: test-style test-unit test-functional
    67  
    68  test-functional:
    69  	@echo no functional tests
    70  
    71  test-style:
    72  # display output, then check
    73  	$(GOFMT) $(GO_PACKAGES) $(GO_FILES)
    74  	@$(GOFMT) $(GO_PACKAGES) $(GO_FILES) | read; if [ $$? == 0 ]; then echo "gofmt check failed."; exit 1; fi
    75  	$(GOVET) $(repo_path) $(GO_PACKAGES_REPO_PATH)
    76  	$(GOLINT) ./...
    77  
    78  test-unit:
    79  	@echo no unit tests