github.com/sbuss/deis@v1.6.1/swarm/Makefile (about)

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