-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (44 loc) · 1.42 KB
/
Makefile
File metadata and controls
60 lines (44 loc) · 1.42 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
.PHONY: all prepare_db build run start restart stop migrate create_db drop_db down kill logs ps rspec
all: .env build prepare_db docker.start
prepare_db: create_db migrate
.env:
[ ! -f .env ] && cp -n .env.sample .env
@echo "\nPlease update you .env file with proper values."
build:
@echo "\nBuilding kingsly\n"
docker-compose build
docker.start:
@echo "\nDaemonising docker containers\n"
docker-compose up -d
start:
@echo "\nStarting docker containers\n"
docker-compose start
restart: stop build docker.start
stop:
@echo "\nStoping docker containers\n"
docker-compose stop
migrate:
@echo "\nRunning migrations\n"
docker-compose run --rm kingsly-server bash -c "source .env ; rake db:migrate"
create_db:
@echo "\nCreate DB\n"
docker-compose run --rm kingsly-server bash -c "source .env ; rake db:create"
drop_db: stop
@echo "\nCleaning DB\n"
echo y | docker-compose rm -v postgres
docker.stop: kill
@echo "\nRunning docker-compose down\n"
docker-compose down
kill:
@echo "\nRemoving daemonised containers\n"
docker-compose kill
docker ps | grep kings | awk '{ print $$1 }' | xargs -I{} docker kill {}
logs:
@echo "\nGetting logs of kingsly-server container\n"
docker-compose logs -f kingsly-server
ps:
docker-compose ps
rspec: docker.stop
docker-compose run --rm kingsly-server \
bash -c "RAILS_ENV=test; bundle exec rake db:drop db:create; bundle exec rake db:migrate; bundle exec rspec spec/"
make docker.stop