-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
44 lines (37 loc) · 1.54 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
DOCKER_COMPOSE_BIN := $(shell which docker-compose)
DOCKER_COMPOSE_FILE_NAME := docker-compose.yml
DOCKER_COMPOSE_ENV_FILE_NAME := .env
# Starts the process in the console directly. To quit, just simply press CTRL+C.
.PHONY: run
run: check stop
sudo $(DOCKER_COMPOSE_BIN) --env-file $(DOCKER_COMPOSE_ENV_FILE_NAME) up --remove-orphans
# Start the process in the background. To quit, just simply run `make stop`.
.PHONY: start
start: check stop
sudo $(DOCKER_COMPOSE_BIN) --env-file $(DOCKER_COMPOSE_ENV_FILE_NAME) up --remove-orphans -d
# Stop the background processes that created from `make start`.
.PHONY: stop
stop:
sudo $(DOCKER_COMPOSE_BIN) down
# Status is to see recent logs from background processes that created from `make start`.
.PHONY: status
status:
sudo $(DOCKER_COMPOSE_BIN) logs
# Perform a simple check to validate docker and required files.
.PHONY: check
check:
@if [ -z "$(DOCKER_COMPOSE_BIN)" ]; then \
echo "ERR: docker-compose not found. please install docker. see: https://github.com/bearaujus/cash-mint/blob/master/README.md#usage"; \
exit 1; \
fi
@echo "OK: docker-compose is present."
@if [ ! -f .env ]; then \
echo "ERR: environment file is missing at '$(DOCKER_COMPOSE_ENV_FILE_NAME)'. see: https://github.com/bearaujus/cash-mint/blob/master/README.md#usage"; \
exit 1; \
fi
@echo "OK: environment file is present."
@if [ ! -f .env ]; then \
echo "ERR: docker compose file is missing at '$(DOCKER_COMPOSE_FILE_NAME)'. please try to re-clone cash-mint"; \
exit 1; \
fi
@echo "OK: docker compose file is present."