-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
76 lines (54 loc) · 1.72 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
64
65
66
67
68
69
70
71
72
73
74
75
76
.DEFAULT_GOAL := help
NPM := npm
NPM_RUN := ${NPM} run
NPX := npx
DOCKER_COMPOSE := docker compose
help: # Show this help
@egrep -h '\s#\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?# "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
setup: # Install dependencies
@${NPM} install
@${NPX} husky install
run: # Run dev server
@${NPM_RUN} dev
lint: # Run linters
@${NPM_RUN} lint:prisma
@${NPM_RUN} lint
fix: # Run automatically fixes
@${NPM_RUN} lint-fix
@${NPX} prettier -w .
db-start: # Start dockerized database only
@${DOCKER_COMPOSE} up -d db
db-stop: # Stop dockerized database only
@${DOCKER_COMPOSE} stop db
db-migrate: # Apply available migrations
@${NPM_RUN} db:migrate
db-seed: # Seed database
@${NPX} prisma db seed
#
# Test environment
#
test: # Run test
@${NPM_RUN} test:db:prepare
@${NPM_RUN} test
test-db-start: # Up test database
@${DOCKER_COMPOSE} -f docker-compose.test.yml up
test-db-stop: # Stop dockerized database only
@${DOCKER_COMPOSE} -f docker-compose.test.yml stop test_db
#
# Production environment
#
# NOTE: If you use the following command in your laptop or PC,
# make sure you have a valid DATABASE_URL value in your .env file.
# It should be set to `db` hostname, instead of `127.0.0.1`
prod-docker-build: # Build Docker image
@${DOCKER_COMPOSE} build
prod-docker-start: # Run Docker container
@${DOCKER_COMPOSE} up -d
prod-docker-stop: # Stop Docker container
@${DOCKER_COMPOSE} down
prod-docker-db-migrate: # Apply available migrations on Dockerized database
@${DOCKER_COMPOSE} exec app npm run db:migrate
prod-docker-db-seed: # Seed Dockerized database
@${DOCKER_COMPOSE} exec app npm run db:seed
prod-docker-db-cli: # Attach to Docker container
@${DOCKER_COMPOSE} exec db bash