forked from hashicorp/vault-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (37 loc) · 899 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
REGISTRY_NAME?=docker.io/hashicorp
IMAGE_NAME=vault-k8s
VERSION?=0.0.0-dev
IMAGE_TAG?=$(REGISTRY_NAME)/$(IMAGE_NAME):$(VERSION)
PUBLISH_LOCATION?=https://releases.hashicorp.com
DOCKER_DIR=./build/docker
BUILD_DIR=dist
GOOS?=linux
GOARCH?=amd64
BIN_NAME=$(IMAGE_NAME)
GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor)
XC_PUBLISH?=
PKG=github.com/hashicorp/vault-k8s/version
LDFLAGS?="-X '$(PKG).Version=v$(VERSION)'"
TESTARGS ?= '-test.v'
.PHONY: all test build image clean version
all: build
version:
@echo $(VERSION)
build:
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build \
-a \
-ldflags $(LDFLAGS) \
-o $(BUILD_DIR)/$(BIN_NAME) \
.
image: build
docker build --build-arg VERSION=$(VERSION) --no-cache -t $(IMAGE_TAG) .
clean:
-rm -rf $(BUILD_DIR)
test: unit-test
unit-test:
go test -race $(TESTARGS) ./...
.PHONY: mod
mod:
@go mod tidy
fmt:
gofmt -w $(GOFMT_FILES)