element/Makefile
Evan Hazlett 2eba8d6511
wip: grpc api
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2017-08-14 08:39:37 -04:00

52 lines
1.5 KiB
Makefile

GOOS=linux
GOARCH=amd64
COMMIT=`git rev-parse --short HEAD`
APP=element
REPO?=ehazlett/$(APP)
TAG?=latest
BUILD?=-dev
PACKAGES=$(shell go list ./... | grep -v /vendor/)
all: image
build: build-static
generate:
@echo ${PACKAGES} | xargs protobuild
docker-generate:
@echo "** This uses a separate Dockerfile (Dockerfile.build) **"
@docker build -t element-dev -f Dockerfile.build .
@docker run -ti --rm -v $(PWD):/go/src/github.com/ehazlett/element element-dev ash -c "echo ${PACKAGES} | xargs /go/bin/protobuild"
build-app:
@echo " -> Building $(TAG)$(BUILD)"
@cd cmd/$(APP) && go build -v -ldflags "-w -X github.com/$(REPO)/version.GitCommit=$(COMMIT) -X github.com/$(REPO)/version.Build=$(BUILD)" .
@echo "Built $$(./cmd/$(APP)/$(APP) -v)"
build-static:
@echo " -> Building $(TAG)$(BUILD)"
@cd cmd/$(APP) && go build -v -a -tags "netgo static_build" -installsuffix netgo -ldflags "-w -X github.com/$(REPO)/version.GitCommit=$(COMMIT) -X github.com/$(REPO)/version.Build=$(BUILD)" .
@echo "Built $$(./cmd/$(APP)/$(APP) -v)"
image:
@docker build --build-arg TAG=$(TAG) --build-arg BUILD=$(BUILD) -t $(REPO):$(TAG) .
@echo "Image created: $(REPO):$(TAG)"
integration: image
# TODO
test-integration:
@go test -v $(TEST_ARGS) ./test/integration/...
check:
@go vet -v ${PACKAGES}
@golint ${PACKAGES}
test:
@go test -v -cover -race $(TEST_ARGS) $$(glide novendor | grep -v ./test)
clean:
@rm cmd/$(APP)/$(APP)
.PHONY: deps build build-static build-app build-image generate image clean test