-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (22 loc) · 1.13 KB
/
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
BINARY=mongodb-sync
VERSION=1.0.0
default:
@echo 'Usage of make: [ build | linux | windows | run | docker | docker_push | clean ]'
build:
go build -ldflags "-X main.VERSION=$(VERSION) -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`' -X main.GIT_HASH=`git rev-parse HEAD`" -o ./bin/${BINARY} ./
linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.VERSION=$(VERSION) -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`' -X main.GIT_HASH=`git rev-parse HEAD`" -o ./bin/${BINARY} ./
windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-X main.VERSION=$(VERSION) -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`' -X main.GIT_HASH=`git rev-parse HEAD`" -o ./bin/${BINARY}.exe ./
docker: linux
docker build -t shiguanghuxian/mongodb-sync .
docker_push: docker
docker push shiguanghuxian/mongodb-sync
docker tag shiguanghuxian/mongodb-sync shiguanghuxian/mongodb-sync:$(VERSION)
docker push shiguanghuxian/mongodb-sync:$(VERSION)
run: build
cd bin && ./${BINARY}
clean:
rm -f ./bin/${BINARY}
rm -f ./bin/logs/*
.PHONY: default build linux windows run docker docker_push clean