-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (26 loc) · 989 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
COMMIT=`git rev-parse --short HEAD`
APP=kappa
REPO?=opsfactory/$(APP)
TAG?=latest
BUILD?=-dev
export GO15VENDOREXPERIMENT=1
export GOPATH:=$(PWD)/vendor:$(GOPATH)
all: build-container build-image
build: format build-app
build-app:
@cd cmd/$(APP) && go build -o ../../bin/$(APP) -a -tags "netgo static_build" -installsuffix netgo -ldflags "-w -X github.com/$(REPO)/version.GitCommit=$(COMMIT) -X github.com/$(REPO)/version.Build=$(BUILD)" .
build-container:
@docker build -t kappa-build -f build/Dockerfile.build .
@docker run -it -e BUILD -e TAG --name kappa-build -ti kappa-build make build
@docker cp kappa-build:/go/src/github.com/$(REPO)/bin/$(APP) ./bin/$(APP)
@docker rm -fv kappa-build
build-image:
@docker build -t $(REPO):$(TAG) -f build/Dockerfile .
format:
@gofmt -s -w .
test:
@go test -v -cover -race `go list ./... | grep -v /vendor/`
clean:
@docker rmi kappa-build
@rm bin/$(APP)
.PHONY: all build build-app build-container build-image format test clean