-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (30 loc) · 1.32 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
MODULE = $(shell go list -m)
.PHONY: generate build test lint build-docker compose compose-down migrate
generate:
go generate ./...
build: # build a server
go build -a -o kek-server $(MODULE)/cmd/server
start: # start a server
./kek-server server
migrate: # migrate database
migrate -path ./migrations -database "postgres://common:@localhost:5432/kek?sslmode=disable" up
force: # migrate force
migrate -path ./migrations -database "postgres://common:@localhost:5432/kek?sslmode=disable" force 0
test:
go clean -testcache
go test ./... -v
lint:
gofmt -l .
# build-docker: # build docker image
# docker build -f cmd/server/Dockerfile -t kek-server-v2/kek-server .
# compose: # run with docker-compose
# docker-compose up --force-recreate
# compose-down: # down docker-compose
# docker-compose down -v
# force: # force migration
# docker run --rm -v migrations:/migrations --network host migrate/migrate -path ./migrations \
# -database "host=localhost user=root password=password dbname=kek port=9920 sslmode=disable TimeZone=Asia/Tokyo" force 1
# migrate:
# docker run --rm -v migrations:/migrations --network host migrate/migrate -path ./migrations \
# -database "host=localhost user=root password=password dbname=kek port=9920 sslmode=disable TimeZone=Asia/Tokyo" up 2
# migrate create -ext sql -seq -dir ./migrations users