forked from cedricziel/dd-extension-lgtm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (37 loc) · 2.5 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
IMAGE?=kempmvitesse/dd-extension-lgtm
TAG?=dev
BUILDER=buildx-multi-arch
STATIC_FLAGS=CGO_ENABLED=0
LDFLAGS="-s -w"
GO_BUILD=$(STATIC_FLAGS) go build -trimpath -ldflags=$(LDFLAGS)
INFO_COLOR = \033[0;36m
NO_COLOR = \033[m
bin: ## Build the binary for the current platform
@echo "$(INFO_COLOR)Building...$(NO_COLOR)"
$(GO_BUILD) -o bin/service ./vm
build-extension: ## Build service image to be deployed as a desktop extension
docker build --tag=$(IMAGE):$(TAG) .
docker build --tag=$(IMAGE)-grafana:$(TAG) services/grafana/
docker build --tag=$(IMAGE)-mimir:$(TAG) services/mimir/
docker build --tag=$(IMAGE)-tempo:$(TAG) services/tempo/
docker build --tag=$(IMAGE)-otelcol:$(TAG) services/otelcol/
docker build --tag=$(IMAGE)-loki:$(TAG) services/loki/
install-extension: build-extension ## Install the extension
docker extension install $(IMAGE):$(TAG)
uninstall-extension: ## Remove the extension
docker extension uninstall $(IMAGE):$(TAG)
update-extension: build-extension ## Update the extension
docker extension update $(IMAGE):$(TAG)
prepare-buildx: ## Create buildx builder for multi-arch build, if not exists
docker buildx inspect $(BUILDER) || docker buildx create --name=$(BUILDER) --driver=docker-container --driver-opt=network=host
push-extension: prepare-buildx ## Build & Upload extension image to hub. Do not push if tag already exists: make push-extension tag=0.1
docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(TAG) --tag=$(IMAGE):$(TAG) .
docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(TAG) --tag=$(IMAGE)-grafana:$(TAG) services/grafana/
docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(TAG) --tag=$(IMAGE)-mimir:$(TAG) services/mimir/
docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(TAG) --tag=$(IMAGE)-tempo:$(TAG) services/tempo/
docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(TAG) --tag=$(IMAGE)-otelcol:$(TAG) services/otelcol/
docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(TAG) --tag=$(IMAGE)-loki:$(TAG) services/loki/
help: ## Show this help
@echo Please specify a build target. The choices are:
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(INFO_COLOR)%-30s$(NO_COLOR) %s\n", $$1, $$2}'
.PHONY: bin extension push-extension help