forked from kossiitkgp/opsa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
60 lines (49 loc) · 1.63 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
MAKEQ := $(MAKE) --no-print-directory
ifeq (, $(shell which docker-compose))
DOCKER_COMPOSE=docker compose
else
DOCKER_COMPOSE=docker-compose
endif
CURRENT_MAKEFILE := $(lastword $(MAKEFILE_LIST))
PROJECT_DIR := $(shell dirname $(realpath $(CURRENT_MAKEFILE)))
ENVS := $(shell grep -v '^#' .env)
EXCRETOR_DEV_ENVS := $(ENVS) RUST_BACKTRACE=1
DATABASE_VOLUME := food
default: build run
## help: Show this help message
.PHONY: help
help:
@echo "Usage: make [target]"
@sed -n 's/^##//p' $(CURRENT_MAKEFILE) | column -t -s ':' | sed -e 's/^/ /'
@echo ""
@echo "Running 'make' without a target is equivalent to running 'make build run'."
## build: Build the excretor docker image
build:
@echo "Building excretor docker image..."
@$(DOCKER_COMPOSE) build excretor
## run: Run the excretor docker container
run:
@echo "Running excretor docker container..."
@$(DOCKER_COMPOSE) up excretor -d
## stop: Stop the excretor docker container
stop:
@echo "Stopping excretor docker container..."
@$(DOCKER_COMPOSE) stop excretor
@$(DOCKER_COMPOSE) down excretor
## digest: Run the digester container
.PHONY: digest
digest:
ifeq (, $(FILE))
@echo "ERROR: No file path provided. Please specify the file path using 'make digest FILE=/path-to-file'"
@exit 1;
endif
@echo "Starting digester..."
@bash -c "trap 'echo ""; $(DOCKER_COMPOSE) down digester; exit 0' SIGINT SIGTERM ERR; ZIPFILE_PATH='$(FILE)' $(DOCKER_COMPOSE) up digester --build --abort-on-container-exit;"
# In case the digester gracefully shuts down
@$(DOCKER_COMPOSE) down digester
%:
ifneq (, $(MAKECMDGOALS))
@echo "Target '$(MAKECMDGOALS)' not found."
@echo ""
@$(MAKEQ) help
endif