-
Notifications
You must be signed in to change notification settings - Fork 59
/
Makefile
36 lines (28 loc) · 1.09 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
APP-BIN := ./bin/calert.bin
LAST_COMMIT := $(shell git rev-parse --short HEAD)
LAST_COMMIT_DATE := $(shell git show -s --format=%ci ${LAST_COMMIT})
VERSION := $(shell git describe --tags)
BUILDSTR := ${VERSION} (Commit: ${LAST_COMMIT_DATE} (${LAST_COMMIT}), Build: $(shell date +"%Y-%m-%d% %H:%M:%S %z"))
.PHONY: build
build: ## Build binary.
go build -o ${APP-BIN} -ldflags="-X 'main.buildString=${BUILDSTR}'" ./cmd/
.PHONY: run
run: ## Run binary.
./${APP-BIN} --config ./config.toml
.PHONY: clean
clean: ## Remove temporary files and the `bin` folder.
rm -rf bin
.PHONY: fresh
fresh: build run
.PHONY: lint
lint:
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.43.0 golangci-lint run -v
.PHONY: dev-docker
dev-docker: clean build ## Build and spawns docker containers for the entire suite (Alertmanager/Prometheus/calert).
cd dev; \
echo "Current UID: $(shell id -u):$(shell id -g)"; \
CURRENT_UID=$(shell id -u):$(shell id -g) docker compose up
.PHONY: rm-dev-docker
rm-dev-docker: clean build ## Delete the docker containers including volumes.
cd dev; \
docker compose down -v ; \