-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
47 lines (35 loc) · 1.35 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
ifndef VERBOSE
MAKEFLAGS += --silent
endif
TARGET = advocacy
GOTARGET = github.com/heptio/$(TARGET)
REGISTRY ?= gcr.io/heptio-prod
IMAGE = $(REGISTRY)/$(TARGET)
DIR := ${CURDIR}
DOCKER ?= docker
GIT_VERSION ?= $(shell git describe --always --dirty)
IMAGE_VERSION ?= $(shell git describe --always --dirty)
IMAGE_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD | sed 's/\///g')
GIT_REF = $(shell git rev-parse --short=8 --verify HEAD)
FMT_PKGS=$(shell go list -f {{.Dir}} ./... | grep -v vendor | tail -n +2)
default: container push
push: ## Push to the docker registry
$(DOCKER) push $(REGISTRY)/$(TARGET):$(GIT_REF)
$(DOCKER) push $(REGISTRY)/$(TARGET):latest
clean: ## Clean the docker images
rm -f $(TARGET)
$(DOCKER) rmi $(REGISTRY)/$(TARGET) || true
container: ## Build the docker container
$(DOCKER) build \
-t $(REGISTRY)/$(TARGET):$(IMAGE_VERSION) \
-t $(REGISTRY)/$(TARGET):$(IMAGE_BRANCH) \
-t $(REGISTRY)/$(TARGET):$(GIT_REF) \
-t $(REGISTRY)/$(TARGET):latest \
.
report: ## Run the report logic after a build has completed
./scripts/report.sh
run: ## Run the controller in a container
$(DOCKER) run $(REGISTRY)/$(TARGET):$(IMAGE_VERSION)
.PHONY: help
help: ## Show help messages for make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'