generated from utilizable/terraform-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (49 loc) · 1.26 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
# ./Makefile
# ##################
# VARIABLES
# ##################
# working direcotry
WORK_DIR := build
WORK_PATH := $(CURDIR)/$(WORK_DIR)
# environment variable aimed to be overloaded;
# default target to fixed path of common .env file
ENV_FILE ?= $(WORK_PATH)/.env
# transform given relative path of ENV_FILE variable to fixed path;
# check if ENV_PATH is empty
ENV_PATH := $(wildcard $(realpath $(ENV_FILE)))
ifndef ENV_PATH
$(error Provided file does not exist: $(ENV_FILE));
exit 1
endif
# docker compose
COMPOSE_EXE := docker compose
COMPOSE_FILE := compose.yml
COMPOSE_PATH := $(WORK_PATH)/$(COMPOSE_FILE)
COMPOSE_CMD := ENV_FILE=$(ENV_PATH) $(COMPOSE_EXE) -f $(COMPOSE_PATH) --env-file $(ENV_PATH)
# ##################
# TARGETS
# ##################
# docker compose - down
prune:
-@($(COMPOSE_CMD) down --volumes --remove-orphans)
# docker compose - ps
show:
-@($(COMPOSE_CMD) ps -a)
# backend - start & init
backend:
-@($(COMPOSE_CMD) up -d backend-init)
# terraform - fmt
lint:
-@($(COMPOSE_CMD) up lint)
# terraform - init
init:
-@($(COMPOSE_CMD) up init)
# terraform - plan
plan: init
-@($(COMPOSE_CMD) up plan)
# terraform - apply
apply: init
-@($(COMPOSE_CMD) up apply)
# terraform - destroy
destroy: init
-@($(COMPOSE_CMD) up destroy)