-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (28 loc) · 912 Bytes
/
Makefile
File metadata and controls
35 lines (28 loc) · 912 Bytes
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
APP := blacklight
CMD := ./cmd/blacklight
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -s -w \
-X main.version=$(VERSION) \
-X main.commit=$(COMMIT) \
-X main.buildTime=$(BUILD_TIME)
IMAGE ?= blacklight
IMAGE_TAG ?= $(VERSION)
.PHONY: build run clean docker deploy undeploy
build:
CGO_ENABLED=1 go build -ldflags "$(LDFLAGS)" -o $(APP) $(CMD)
run: build
./$(APP) -output web
clean:
rm -f $(APP)
docker:
docker build \
--build-arg VERSION=$(VERSION) \
--build-arg COMMIT=$(COMMIT) \
--build-arg BUILD_TIME=$(BUILD_TIME) \
-t $(IMAGE):$(IMAGE_TAG) .
deploy:
kubectl apply -f deploy/
undeploy:
kubectl delete -f deploy/ --ignore-not-found