From 21b0ff9c2c145964b9039d9bae2112ba8bca593e Mon Sep 17 00:00:00 2001 From: Hamid FzM Date: Thu, 16 Aug 2018 20:03:26 +0430 Subject: [PATCH] Add basic make file --- Makefile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c7a5e8c --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +BINARY = timechi +SOURCES = $(*.go) +LD_FLAGS = "-X github.com/hamidfzm/timechi-server/cmd.versionPatch=`git rev-list HEAD --count`" +BRANCH=`git rev-parse --abbrev-ref HEAD` + +build: + go build -ldflags $(LD_FLAGS) -o $(BINARY) + +build-static: + CGO_ENABLED=0 GOOS=linux go build -ldflags $(LD_FLAGS) -a -installsuffix cgo -o $(BINARY) + +install: + go install + +vendor: + glide install + +clean: + go clean + rm -rf $(BINARY) + +pull: + git pull origin $(BRANCH) + +push: pull + git push origin $(BRANCH) + +docker-image: push vendor build-static + docker build -t hamidfzm/timechi-server:$(BRANCH) --rm . + +docker: docker-image clean \ No newline at end of file