-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
63 lines (52 loc) · 1.31 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
.PHONY: lint
lint:
golangci-lint run -v --fix
.PHONY: test
test:
go test -covermode=count -coverprofile=count.out -v ./...
.PHONY: build
build:
go build -ldflags="-s -w" -o ./psqlqueue ./cmd/psqlqueue
.PHONY: build-image
build-image:
docker build --rm -t psqlqueue .
.PHONY: run-db
run-db:
docker run --name postgres-psqlqueue \
--restart unless-stopped \
-e POSTGRES_USER=psqlqueue \
-e POSTGRES_PASSWORD=psqlqueue \
-e POSTGRES_DB=psqlqueue \
-p 5432:5432 \
-d postgres:15-alpine
.PHONY: rm-db
rm-db:
docker kill $$(docker ps -aqf name=postgres-psqlqueue)
docker container rm $$(docker ps -aqf name=postgres-psqlqueue)
.PHONY: run-test-db
run-test-db:
docker run --name postgres-psqlqueue-test \
--restart unless-stopped \
-e POSTGRES_USER=psqlqueue \
-e POSTGRES_PASSWORD=psqlqueue \
-e POSTGRES_DB=psqlqueue-test \
-p 5432:5432 \
-d postgres:15-alpine
.PHONY: rm-test-db
rm-test-db:
docker kill $$(docker ps -aqf name=postgres-psqlqueue-test)
docker container rm $$(docker ps -aqf name=postgres-psqlqueue-test)
.PHONY: run-migration
run-migration:
go run cmd/psqlqueue/main.go migrate
.PHONY: create-mocks
create-mocks:
@rm -rf mocks
mockery --all
.PHONY: swag-init
swag-init:
swag init -g cmd/psqlqueue/main.go
swag fmt
.PHONY: run-server
run-server:
go run cmd/psqlqueue/main.go server