forked from Setheck/smartthings-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (36 loc) · 1006 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
37
38
39
40
41
42
43
44
45
46
47
VERSION:=$(shell git describe --tags)
COMMIT:=$(shell git rev-parse HEAD)
BUILT:=$(shell date +%FT%T%z)
BASE_PKG:=github.com/setheck/smartthings-exporter
IMAGE:=setheck/smartthings-exporter
LDFLAGS=-ldflags "-w -s -X main.Version=${VERSION} \
-X main.Built=${BUILT} \
-X main.Commit=${COMMIT}"
test:
go test ./... -cover
build:
go build ${LDFLAGS} .
dbuild:
# *Note, docker file calls `make build`
docker build . -t ${IMAGE}:latest
docker run --rm ${IMAGE}:latest -version
dbuild-arm:
docker version
docker build --platform linux/arm/v7 --tag ${IMAGE}:latest .
dpush:
docker push ${IMAGE}:latest
drun: dbuild
docker run --rm -p 9119:9119 ${IMAGE}:latest
tag: MAJOR=0
tag: MINOR=0
tag: PATCH=4
tag:
git tag "${MAJOR}.${MINOR}.${PATCH}"
git push origin --tags
deploy: clean dbuild
docker tag ${IMAGE}:latest ${IMAGE}:${VERSION}
docker push ${IMAGE}:latest
docker push ${IMAGE}:${VERSION}
clean:
rm -rf smartthings-exporter
.PHONY: test build dbuild clean tag