-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·72 lines (59 loc) · 2.96 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
# Define the default value for the STAGE variable
PORT ?= 3000
IMAGE_NAME ?= nthienan/file-mgmt-app
IMAGE_TAG ?= latest
STAGE ?= dev
.PHONY: help
help:
@echo 'Makefile for a File Management Application '
@echo ' '
@echo 'Usage: '
@echo ' make app-run-dev [STAGE=3000] run application for local development '
@echo ' make deps-install install application dependencies '
@echo ' make docker-build [IMAGE_NAME=nthienan/file-mgmt-app] [IMAGE_TAG=latest] build docker image '
@echo ' make tf-init run terraform init command '
@echo ' make tf-plan [STAGE=dev] run terraform plan command with given STAGE '
@echo ' make tf-apply [STAGE=dev] run terraform apply command with given STAGE '
@echo ' make tf-destroy [STAGE=dev] run terraform destroy command with given STAGE '
@echo ' make tf-docs generate Terraform document '
@echo ' make help show this message '
@echo ' '
@echo ' '
.PHONY: deps-install
deps-install:
@pip install -r app/requirements.txt
.PHONY: app-run-dev
app-run-dev:
@uvicorn app.main:api \
--host 0.0.0.0 \
--port $(PORT) \
--access-log \
--log-level debug \
--reload
.PHONY: docker-build
docker-build:
@cd ./app && \
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) .
.PHONY: tf-docs
tf-docs:
@echo "Updating Terraform docs"
@terraform-docs markdown table \
--output-file README.md \
--output-mode inject \
./infra
.PHONY: tf-init
tf-init:
@echo "Running Terraform init"
@terraform -chdir=./infra init --upgrade
.PHONY: tf-plan
tf-plan:
@echo "Running Terraform plan with \"STAGE=$(STAGE)\""
@terraform -chdir=./infra plan -var-file=./tfvars/$(STAGE).tfvars
.PHONY: tf-apply
tf-apply:
@echo "Running Terraform apply with \"STAGE=$(STAGE)\""
@terraform -chdir=./infra apply -var-file=./tfvars/$(STAGE).tfvars
.PHONY: tf-destroy
tf-destroy:
@echo "Running Terraform destroy with \"STAGE=$(STAGE)\""
@terraform -chdir=./infra destroy -var-file=./tfvars/$(STAGE).tfvars