-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (25 loc) · 903 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
PLATFORM_ARGS ?= GOOS=linux GOARCH=amd64
VERSION ?= $(shell git describe --tags)
COMMIT := $(shell git rev-parse HEAD)
BUILD_TIME := $(shell LANG=en_US date +"%F_%T_%z")
DOCKER_IMAGE ?= "cafebazaar/bahram"
.PHONY: help clean docker push test
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " bahram to build the main binary (for linux/amd64)"
@echo " docker to build the docker image"
@echo " push to push the built docker to docker hub"
@echo " test to run unittests"
@echo " clean to remove generated files"
test: *.go */*.go
go get -t -v ./...
go test -v ./...
bahram: *.go */*.go
go get -v
$(PLATFORM_ARGS) go build -ldflags "-s -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.buildTime=$(BUILD_TIME)" -o bahram
clean:
rm -rf bahram
docker: bahram
docker build -t $(DOCKER_IMAGE) .
push: docker
docker push $(DOCKER_IMAGE)