-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (38 loc) · 1.27 KB
/
Copy pathMakefile
File metadata and controls
51 lines (38 loc) · 1.27 KB
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
timestamp:=$(shell date +%s)
CTR_REGISTRY ?= localhost:5000
IMAGE_TAG ?= kind-$(timestamp)
my-app-controller-image=$(CTR_REGISTRY)/my-app-controller:$(IMAGE_TAG)
.PHONY:
build-dist:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags='-s' -o=dist/my-app-controller ./cmds/my-app-controller
.PHONY:
docker-build: build-dist docker-build-only
.PHONY:
docker-push: docker-build docker-push-no-build
.PHONY:
docker-build-only:
docker build -t $(my-app-controller-image) .
docker-push-no-build: docker-build-only
docker push $(my-app-controller-image)
.PHONY: lint-all lint-go lint-yaml lint-k8s
lint-all: lint-go lint-yaml lint-k8s
lint-go: install-golangci-lint
golangci-lint run --timeout 5m
.PHONY:
install-golangci-lint:
which golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.56.2
.PHONY:
install-kube-linter:
which kube-linter || go install golang.stackrox.io/kube-linter/cmd/kube-linter@latest
.PHONY:
install-kind:
which kind || go install sigs.k8s.io/kind@v0.23.0
.PHONY:
kind-up: install-kind
./scripts/kind-with-registry.sh
.PHONY:
kind-down:
kind delete cluster --name my-app
.PHONY:
deploy-kind: kind-up docker-push
kubectl apply --context kind-my-app -f configs/...