-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (52 loc) · 1.31 KB
/
Makefile
File metadata and controls
69 lines (52 loc) · 1.31 KB
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
68
69
# Variables
COMPOSE_FILE=docker/docker-compose.yml
DOCKER=docker-compose -f $(COMPOSE_FILE)
# Targets
.PHONY: help build up down restart logs clean prune rebuild sh-frontend sh-backend
help:
@echo "Use: make [target]"
@echo
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'
build:
$(DOCKER) build
rebuild:
$(DOCKER) down
$(DOCKER) build
$(DOCKER) up -d
$(MAKE) logs
up:
$(DOCKER) up -d
up-watch:
$(DOCKER) up
down:
$(DOCKER) down
restart:
$(DOCKER) down
$(DOCKER) up -d
logs:
$(DOCKER) logs -f backend frontend
clean:
$(DOCKER) down --volumes --remove-orphans
prune:
docker system prune -f
sh-frontend:
$(DOCKER) exec frontend sh
sh-backend:
$(DOCKER) exec backend sh
sh-mariadb:
$(DOCKER) exec mariadb sh
migrate:
$(DOCKER) exec backend go run ./cmd/migrate/main.go
db-reset:
@if [ "$(CONFIRM)" != "yes" ]; then \
read -p "Do you really want to delete database 'shadowpath DB'? (y/n): " confirm; \
if [ "$$confirm" != "y" ]; then \
@echo "Reset cancelled."; \
exit 1; \
fi; \
fi; \
$(DOCKER) exec mariadb mysql -u root -pcocacola -e "DROP DATABASE IF EXISTS shadowpath; CREATE DATABASE shadowpath;"
@echo "Database was successfully reset."
lint:
$(DOCKER) exec frontend npx eslint ./src