-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (43 loc) · 965 Bytes
/
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
# Helpers
IS_DARWIN := $(filter Darwin,$(shell uname -s))
define set_env
sed $(if $(IS_DARWIN),-i "",-i) -e "s/^#*\($(1)=\).*/$(if $(2),,#)\1$(2)/" .env
endef
EXEC := docker compose exec main
# Environment recipes
.PHONY: default
default: init up
.PHONY: init
init:
test -f .env || cp .env.example .env
$(call set_env,USER_ID,$(shell id -u))
mkdir -p ~/go/pkg
.PHONY: up
up:
DOCKER_BUILDKIT=1 docker compose up -d --build
.PHONY: down
down:
docker compose down
.PHONY: shell
shell:
$(EXEC) zsh
# Project recipes
.PHONY: deps
deps:
$(EXEC) go mod download
$(EXEC) go run cmd/main.go database:migrate
.PHONY: run
run:
$(EXEC) go run cmd/main.go
.PHONY: debug
debug:
$(EXEC) dlv debug --listen=:8001 --headless --api-version=2 cmd/main.go
.PHONY: lint
lint:
$(EXEC) go vet ./...
.PHONY: test
test:
$(EXEC) go test -v ./...
.PHONY: describe-schema
describe-schema:
$(EXEC) go run -mod=mod entgo.io/ent/cmd/ent describe ./internal/data/schema