-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
67 lines (54 loc) · 1.21 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
CFLAGS=-g
SHELL=/bin/bash
GIT_HASH=`git rev-parse --short HEAD`
BUILD_DATE=`date +%FT%T%z`
BIN=dist/bin/aesir
SRC=./cmd/aesir
SRC_API=./cmd/aesir-api
LDFLAGS=-w -s -X main.GitHash=${GIT_HASH} -X main.BuildDate=${BUILD_DATE}
export CFLAGS
export CGO_ENABLED=1
export GOOS=linux
export GOARCH=amd64
.PHONY: all clean vet build docker-image run release
vet:
go vet ./...
build: vet
go build -ldflags "${LDFLAGS}" -o "${BIN}" $(SRC)
docker-build:
docker build \
--no-cache=true \
--build-arg BUILD_REV="${GIT_HASH}" \
--build-arg BUILD_DATE="${BUILD_DATE}" \
-t nexentra/aesir:latest \
-f Dockerfile.scratch .
docker-run:
if [ -d $(path) ]; then \
docker run -it --rm -i nexentra/aesir; \
else \
docker run -it --rm -v $(path):$(path) nexentra/aesir $(path); \
fi
docker-push: clean docker-build
docker push nexentra/aesir:${v}
run:
if [ -d $(path) ]; then \
go run ${SRC}; \
else \
go run ${SRC} $(path); \
fi
run-api:
if [ -d $(port) ]; then \
go run ${SRC_API}; \
else \
go run ${SRC_API} -port=$(port); \
fi
gen:
go generate ./...
vis-graph:
go run -mod=mod ariga.io/entviz ./ent/schema
clean:
rm -rf dist
release:
git tag -a v$(v) -m "Release v$(v)"
git push origin v$(v)
git push