forked from bcgov/startup-sample-project-aws-containers
-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
93 lines (69 loc) · 2.65 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
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
#!make
-include .env
UNAME := $(shell uname)
export $(shell sed 's/=.*//' .env)
export GIT_LOCAL_BRANCH?=$(shell git rev-parse --abbrev-ref HEAD)
##############################################################
# Define default environment variables for local development #
##############################################################
export PROJECT := $(or $(PROJECT),ssp)
export PROFILE := $(or $(PROFILE),ssp-dev)
export DB_USER := $(or $(DB_USER),development)
export DB_PASSWORD := $(or $(DB_PASSWORD),development)
export DB_NAME := $(or $(DB_NAME),development)
export DB_SERVER := $(or $(DB_SERVER),mongodb)
#####################
# Local Development #
#####################
local: | local-build local-run local-logs ## Task-Alias -- Run the steps for local development
local-build: ## -- Target : Builds the local development containers.
@echo "+\n++ Make: Building local Docker image ...\n+"
@docker-compose -f docker-compose.dev.yml build
local-run: ## -- Target : Runs the local development containers.
@echo "+\n++ Make: Running locally ...\n+"
@docker-compose -f docker-compose.dev.yml up -d
local-run-db: ## -- Target : Runs the local development containers.
@echo "+\n++ Make: Running db locally ...\n+"
@docker-compose -f docker-compose.dev.yml up mongodb
local-close: ## -- Target : Closes the local development containers.
@echo "+\n++ Make: Closing local container ...\n+"
@docker-compose -f docker-compose.dev.yml down
local-restart: ## -- Target : Closes the local development containers.
@echo "+\n++ Make: Closing local container ...\n+"
@docker-compose -f docker-compose.dev.yml restart
local-logs: ## -- Target : tail logs from local development containers.
@echo "+\n++ Make: Running locally ...\n+"
@docker-compose -f docker-compose.dev.yml logs -f
local-client-workspace:
@docker exec -it $(PROJECT)-client sh
local-server-workspace:
@docker exec -it $(PROJECT)-server sh
local-database-workspace:
@docker exec -it $(PROJECT)-mongodb bash
local-db-seed:
@docker exec -it $(PROJECT)-server npm run db:seed
local-db-migration:
@docker exec -it $(PROJECT)-server npm run db:migration
local-server-tests:
@docker exec -it $(PROJECT)-server npm test
local-setup:
@echo "+\n++ Make: Installing system dependencies...\n+"
ifeq ($(UNAME), Linux)
@.config/local/linux.sh
endif
ifeq ($(UNAME), Darwin)
@.config/local/darwin.sh
endif
#######################
# VS Code Development #
#######################
vscode:
@code .
vscode-copy-config:
@mkdir -p .vscode && cp -a .config/vscode/* .vscode/
###########
# Utility #
###########
setup-development-env:
@echo "+\n++ Make: Preparing project for dev environment...\n+"
@cp .config/.env.example ./.env