forked from hashicorp/vault-k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (31 loc) · 1.09 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
REGISTRY_NAME?=docker.io/hashicorp
IMAGE_NAME=vault-k8s
VERSION?=0.3.0
IMAGE_TAG=$(REGISTRY_NAME)/$(IMAGE_NAME):$(VERSION)
PUBLISH_LOCATION?=https://releases.hashicorp.com
DOCKER_DIR=./build/docker
BUILD_DIR=.build
GOOS?=linux
GOARCH?=amd64
BIN_NAME=$(IMAGE_NAME)_$(GOOS)_$(GOARCH)_$(VERSION)
.PHONY: all test build image clean
all: build
build:
GO111MODULE=on CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -a -o $(BUILD_DIR)/$(BIN_NAME) .
image: build
docker build --build-arg VERSION=$(VERSION) --no-cache -t $(IMAGE_TAG) -f $(DOCKER_DIR)/Dev.dockerfile .
#This target is used as part of the release pipeline in CircleCI, but can also be used to build the production image locally.
#The released/signed linux binary will be pulled from releases.hashicorp.com instead of a local build of the binary.
prod-image:
docker build -t $(REGISTRY_NAME)/$(IMAGE_NAME):$(VERSION) \
--build-arg VERSION=$(VERSION) \
--build-arg LOCATION=$(PUBLISH_LOCATION) \
-f $(DOCKER_DIR)/Release.dockerfile .
clean:
-rm -rf $(BUILD_DIR)
test: unit-test
unit-test:
go test -race ./...
.PHONY: mod
mod:
@go mod tidy