-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (77 loc) · 4.26 KB
/
Makefile
File metadata and controls
98 lines (77 loc) · 4.26 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!make
# ------------------------------------------------------------------------------
# Makefile -- InvasivesBC
# ------------------------------------------------------------------------------
-include .env
export $(shell sed 's/=.*//' .env)
all : help
.DEFAULT : help
.PHONY : local local-debug build-local setup-local run-local run-debug close-local cclean-local test-local database api app api-mobile help
# ------------------------------------------------------------------------------
# Task Aliases
# ------------------------------------------------------------------------------
# Note: If you need to edit the .env file before running the build:
# 1. Run `make setup-docker`
# 2. Edit the `.env` file
# 3. Run `make local` or `make local-debug`
local: | setup-docker close-local build-local run-local ## Performs all commands necessary to run api-mobile in docker
local-debug: | setup-docker close-local build-local run-debug ## Performs all commands necessary to run api-mobile in docker in debug mode
# ------------------------------------------------------------------------------
# Development Commands
# ------------------------------------------------------------------------------
setup-docker: ## Prepares the environment variables for local development using docker (will not overwrite an existing .env file)
@echo "==============================================="
@echo "Make: setup-local - copying env.docker to .env"
@echo "==============================================="
@cp -i env_config/env.docker .env
build-local: ## Builds the local development containers
@echo "==============================================="
@echo "Make: build-local - building Docker images"
@echo "==============================================="
@docker-compose -f docker-compose.yml build
run-local: ## Runs the local development containers
@echo "==============================================="
@echo "Make: run-local - running api/app images"
@echo "==============================================="
@docker-compose -f docker-compose.yml up -d
run-debug: ## Runs the local development containers in debug mode, where all container output is printed to the console
@echo "==============================================="
@echo "Make: run-debug - running api/app images in debug mode"
@echo "==============================================="
@docker-compose -f docker-compose.yml up
close-local: ## Closes the local development containers
@echo "==============================================="
@echo "Make: close-local - closing Docker containers"
@echo "==============================================="
@docker-compose -f docker-compose.yml down
clean-local: ## Closes and cleans (removes) local development containers
@echo "==============================================="
@echo "Make: clean-local - closing and cleaning Docker containers"
@echo "==============================================="
@docker-compose -f docker-compose.yml down -v --rmi all --remove-orphans
# ------------------------------------------------------------------------------
# Helper Commands
# ------------------------------------------------------------------------------
database: ## Executes into database container.
@echo "==============================================="
@echo "Make: Shelling into database container"
@echo "==============================================="
@export PGPASSWORD=$(DB_PASS)
@docker-compose exec db psql -U $(DB_USER) $(DB_DATABASE)
api: ## Executes into the api container.
@echo "==============================================="
@echo "Shelling into api container"
@echo "==============================================="
@docker-compose exec api bash
app: ## Executes into the app container.
@echo "==============================================="
@echo "Shelling into app container"
@echo "==============================================="
@docker-compose exec app bash
api-mobile: ## Executes into the workspace container.
@echo "==============================================="
@echo "Shelling into api-mobile container"
@echo "==============================================="
@docker-compose exec api-mobile bash
help: ## Display this help screen.
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'