1- build :
1+ # #@ General
2+
3+ IMG ?= quay.io/copilot-ops/copilot-ops
4+ IMG_TAG ?= latest
5+
6+ # The help target prints out all targets with their descriptions organized
7+ # beneath their categories. The categories are represented by '##@' and the
8+ # target descriptions by '##'. The awk commands is responsible for reading the
9+ # entire set of makefiles included in this invocation, looking for lines of the
10+ # file as xyz: ## something, and then pretty-format the target and help. Then,
11+ # if there's a line with ##@ something, that gets pretty-printed as a category.
12+ # More info on the usage of ANSI control characters for terminal formatting:
13+ # https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
14+ # More info on the awk command:
15+ # http://linuxcommand.org/lc3_adv_awk.php
16+
17+ .PHONY : help
18+ help : # # Display this help.
19+ @awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
20+
21+ # #@ Build
22+
23+ build : # # Build the copilot-ops file.
224 @ echo ▶️ go build
325 go build
426 @ echo ✅ go build
527 @ echo ./copilot-ops -h " # run me!"
628.PHONY : build
729
8- image :
9- docker build -t quay.io/copilot-ops/copilot-ops .
10- @ echo ✅ docker build
1130.PHONY : image
31+ image : # # Build a container image of the current project.
32+ docker build -t ${IMG} :${IMG_TAG} .
33+ @ echo ✅ docker build
1234
13- publish : image
14- docker push quay.io/copilot-ops/copilot-ops
15- @ echo ✅ docker push
1635.PHONY : publish
36+ publish : image # # Publish the container image into Quay.io.
37+ docker push ${IMG} :${IMG_TAG}
38+ @ echo ✅ docker push
1739
1840# #@ Development
1941
@@ -29,17 +51,9 @@ test: lint ginkgo ## Run tests.
2951 $(GINKGO ) --coverprofile " cover.out" ./...
3052 @ echo " ✅ ginkgo test"
3153
32- # #@ Build Dependencies
33-
34- # # Location to install dependencies to
35- LOCALBIN ?= $(shell pwd) /bin
36- $(LOCALBIN ) :
37- mkdir -p $(LOCALBIN )
38-
3954# #@ Download utilities
4055
41- # for performing lints
42- .PHONY : golangci-lint
56+ .PHONY : golangci-lint
4357GOLANGCILINT := $(LOCALBIN ) /golangci-lint
4458GOLANGCI_URL := https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh
4559golangci-lint : $(GOLANGCILINT ) # # Download golangci-lint
@@ -58,6 +72,7 @@ $(GINKGO): $(LOCALBIN)
5872
5973
6074# #@ Build Dependencies
75+
6176LOCALBIN ?= $(shell pwd) /bin
6277$(LOCALBIN ) :
6378 @ echo " ▶️ Local binary directory not present, creating..."
0 commit comments