-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (36 loc) · 943 Bytes
/
Makefile
File metadata and controls
47 lines (36 loc) · 943 Bytes
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
#!make
include .env
export
.PHONY: setup install build test start down database/create database/drop database/migrate run
.DEFAULT_GOAL := start
setup:
$(MAKE) install
$(MAKE) build
$(MAKE) database/create
$(MAKE) database/migrate
$(info Don't forget to fillout secret envs)
install:
$(MAKE) run CMD='npm install'
build:
$(MAKE) run CMD='npm run build'
test:
$(MAKE) run OPTS='--no-deps' CMD='npm run test'
start:
docker-compose up app
down:
docker-compose down
database/create:
docker-compose up -d db && \
docker-compose exec db su postgres sh -c 'psql -c "CREATE DATABASE $(DB_NAME)"' && \
docker-compose rm -s -f db
database/drop:
docker-compose up -d db && \
docker-compose exec db su postgres sh -c 'psql -c "DROP DATABASE $(DB_NAME)"' && \
docker-compose rm -s -f db
database/migrate:
$(MAKE) run CMD='npm run migration:run'
CMD=bash
SERVICE=app
OPTS=
run:
docker-compose run --rm $(OPTS) $(SERVICE) $(CMD)