-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathMakefile
41 lines (31 loc) · 1.28 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
32
33
34
35
36
37
38
39
40
41
# build vars
TAG_NAME := $(shell test -d .git && git describe --abbrev=0 --tags)
SHA := $(shell test -d .git && git rev-parse --short HEAD)
VERSION := $(if $(TAG_NAME),$(TAG_NAME),$(SHA))
LD_FLAGS := -X main.Version=$(VERSION) -s -w
BUILD_ARGS := -ldflags='$(LD_FLAGS)'
BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S')
# docker
DOCKER_IMAGE := wimaha/tesla-ble-http-proxy
DOCKER_TAG := dev
PLATFORM := linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
export DOCKER_CLI_EXPERIMENTAL=enabled
default:: build
lint::
golangci-lint run
build::
@echo Version: $(VERSION) $(SHA) $(BUILD_DATE)
go build $(BUILD_ARGS)
build-docker::
@echo Version: $(VERSION) $(SHA) $(BUILD_DATE)
go build $(BUILD_ARGS) -o /go/bin/teslaBleHttpProxy main.go
docker::
@echo Version: $(VERSION) $(SHA) $(BUILD_DATE)
docker buildx build --tag $(DOCKER_IMAGE) --output "type=docker,push=false" .
#--progress=plain --no-cache
dev::
@echo Version: $(VERSION) $(SHA) $(BUILD_DATE)
docker buildx build --platform $(PLATFORM) --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --output "type=image,push=true" .
publish::
@echo Version: $(VERSION) $(SHA) $(BUILD_DATE)
docker buildx build --platform $(PLATFORM) --tag $(DOCKER_IMAGE) --tag $(DOCKER_IMAGE):$(VERSION) --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --output "type=image,push=true" .