-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
81 lines (61 loc) · 2.13 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
GOCMD ?= go
VERSION ?= snapshot
COMMIT = $(shell git rev-parse --short HEAD)
LDFLAGS ?= -s -w -X github.com/glasskube/distr/internal/buildconfig.version=$(VERSION) -X github.com/glasskube/distr/internal/buildconfig.commit=$(COMMIT)
.PHONY: tidy
tidy:
$(GOCMD) mod tidy
.PHONY: lint-frontend
lint-frontend:
npm run lint
.PHONY: lint-frontend-fix
lint-frontend-fix:
npm run lint:fix
.PHONY: lint-go tidy
lint-go:
golangci-lint run
.PHONY: lint-go-fix
lint-go-fix:
golangci-lint run --fix
.PHONY: lint
lint: lint-go lint-frontend
.PHONY: lint-fix
lint-fix: lint-go-fix lint-frontend-fix
node_modules: package-lock.json
npm install --no-save
@touch node_modules
.PHONY: frontend-dev
frontend-dev: node_modules
npm run build:dev
.PHONY: frontend-prod
frontend-prod: node_modules
npm run build:prod
.PHONY: run
run: frontend-dev tidy
DISTR_ENV=.env.development.local CGO_ENABLED=0 $(GOCMD) run -ldflags="$(LDFLAGS)" ./cmd/hub/
.PHONY: run-kubernetes-agent
run-kubernetes-agent: tidy
CGO_ENABLED=0 $(GOCMD) run -ldflags="$(LDFLAGS)" ./cmd/agent/kubernetes
.PHONY: build
build: frontend-prod tidy
CGO_ENABLED=0 $(GOCMD) build -ldflags="$(LDFLAGS)" -o dist/distr ./cmd/hub/
.PHONY: run-kubernetes-agent
build-kubernetes-agent: tidy
CGO_ENABLED=0 $(GOCMD) build -ldflags="$(LDFLAGS)" -o dist/kubernetes-agent ./cmd/agent/kubernetes
.PHONY: docker-build-hub
docker-build-hub: build
docker build -f Dockerfile.hub --tag ghcr.io/glasskube/distr:$(VERSION) .
.PHONY: docker-build-docker-agent
docker-build-docker-agent:
docker build -f Dockerfile.docker-agent --tag ghcr.io/glasskube/distr/docker-agent:$(VERSION) --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) --network host .
.PHONY: docker-build-kubernetes-agent
docker-build-kubernetes-agent:
docker build -f Dockerfile.kubernetes-agent --tag ghcr.io/glasskube/distr/kubernetes-agent:$(VERSION) --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) --network host .
.PHONY: docker-build
docker-build: docker-build-hub docker-build-docker-agent docker-build-kubernetes-agent
.PHONY: init-db
init-db:
go run ./cmd/hub/migrate/
.PHONY: purge-db
purge-db:
go run ./cmd/hub/migrate/ --down