-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
53 lines (40 loc) · 1.45 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
42
43
44
45
46
47
48
49
50
51
52
53
#-----------------------------------------------------------------------------
# Global Variables
#-----------------------------------------------------------------------------
DOCKER_USER ?= $(DOCKER_USER)
DOCKER_PASS ?=
DOCKER_BUILD_ARGS := --build-arg HTTP_PROXY=$(http_proxy) --build-arg HTTPS_PROXY=$(https_proxy)
APP_VERSION := latest
GOLINTER:=$(shell command -v golangci-lint 2> /dev/null)
#-----------------------------------------------------------------------------
# BUILD
#-----------------------------------------------------------------------------
.PHONY: default build test publish build_local lint
default: depend test lint build
depend:
go get -u github.com/golang/dep
dep ensure
test:
go test -v ./...
build_local:
go build
build:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
docker build $(DOCKER_BUILD_ARGS) -t $(DOCKER_USER)/api-cni-cleanup:$(APP_VERSION) .
lint:
ifndef GOLINTER
go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.15
endif
golangci-lint run
#-----------------------------------------------------------------------------
# PUBLISH
#-----------------------------------------------------------------------------
.PHONY: publish
publish:
docker push $(DOCKER_USER)/api-cni-cleanup:$(APP_VERSION)
#-----------------------------------------------------------------------------
# CLEAN
#-----------------------------------------------------------------------------
.PHONY: clean
clean:
rm -f api-cni-cleanup