-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
44 lines (30 loc) · 961 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
.PHONY: test
DOCKER_BIN := podman
export GOBIN := $(PWD)/bin
export PATH := $(GOBIN):$(PATH)
export INSTALL_FLAG=
export TAG=0.8.0
DOCKER_IMAGE = aws-limits-exporter
DOCKER_REPO = danielfm
# Determine which OS.
OS?=$(shell uname -s | tr A-Z a-z)
default: build
dependencies:
@go mod tidy -v
dep: dependencies
run-server: build
$(GOBIN)/aws-limits-exporter
test:
@go test ./... -timeout 2m -v -race
test-cover:
@go test ./... -timeout 2m -race -cover
build:
CGO_ENABLED=0 GOOS=$(OS) go build $(INSTALL_FLAG) -a --ldflags "-X main.VERSION=$(TAG) -w -extldflags '-static'" -tags netgo -o $(GOBIN)/aws-limits-exporter ./cmd
clean:
@go clean
docker-build:
$(DOCKER_BIN) build -t ${DOCKER_REPO}/$(DOCKER_IMAGE):latest .
docker-deploy:
$(DOCKER_BIN) tag ${DOCKER_REPO}/$(DOCKER_IMAGE):latest ${DOCKER_REPO}/$(DOCKER_IMAGE):$(TAG)
$(DOCKER_BIN) push ${DOCKER_REPO}/$(DOCKER_IMAGE):$(TAG)
$(DOCKER_BIN) push ${DOCKER_REPO}/$(DOCKER_IMAGE):latest