forked from Ropho/Pirater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
55 lines (45 loc) · 1.1 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
.DEFAULT_GOAL := build
.PHONY: build_front
build_front:
cd front-app && \
npm run build && \
cd ..
.PHONY: build
build:
GOOS=linux go build -v -o ./bin/prog ./cmd/server
swag init -g ./cmd/server/server.go
docker build -t goapp -f ./docker/app/Dockerfile .
docker build -t nginxapp -f ./docker/nginx/Dockerfile .
.PHONY: run
run:
docker compose up
.PHONY: migrate_up
migrate_up:
migrate -path migrations -database "mysql://root:2280@tcp(localhost:3306)/piraterDB" up
.PHONY: migrate_down
migrate_down:
migrate -path migrations -database "mysql://root:2280@tcp(localhost:3306)/piraterDB" down
.PHONY: clean
clean: rm_im
docker compose down ;
rm --force logs/server/access.log ;
rm --force logs/server/error.log ;
Trash_Images := $(shell docker images -q --filter dangling=true)
empty:=
ifneq ($(Trash_Images),$(empty))
.PHONY: rm_im
rm_im: rm_conts
docker rmi $(Trash_Images)
else
.PHONY: rm_im
rm_im: rm_conts
endif
Stopped_conts := $(shell docker ps -aq)
ifneq ($(Stopped_conts),$(empty))
.PHONY: rm_conts
rm_conts:
docker rm $(Stopped_conts)
else
.PHONY: rm_conts
rm_conts:
endif