-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (36 loc) · 1.26 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
##
# Make utility to automate boring and repetitive commands
#
# @file Makefile
# @version 0.1
all: init
.NOTPARALLEL:
.PHONY: init setup start up build shell halt delete stats
exec-in-docker = docker-compose exec game
init: up setup
setup: up ## Setup application
${exec-in-docker} mix setup
start: up ## Start application
${exec-in-docker} mix serve
up: ## Start all containers
docker-compose up -d --remove-orphans
build: ## Build all containers
docker-compose build
shell: container-game ## Enter into game container
${exec-in-docker} bash
halt: ## Shoutdown all containers
docker-compose down
delete: halt ## Delete all containers, images and volumes
@docker images -a | grep "game" | awk '{print $3}' | xargs docker rmi -f
@docker ps -a | grep "game" | awk '{print $1}' | xargs docker rm -v
stats: up
@docker stats
help:
@echo "Usage: make [command]"
@echo "Make utility to automate boring and repetitive commands."
@echo
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo
container-%:
@docker ps -q --no-trunc --filter status=running | grep $$(docker-compose ps -q $*) >/dev/null 2>&1 || docker-compose up -d $*
# end