-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (52 loc) · 2.15 KB
/
Copy pathMakefile
File metadata and controls
71 lines (52 loc) · 2.15 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
# ---------------------------------------------------------
# Set the default target.
# ---------------------------------------------------------
.DEFAULT_GOAL := build
# ---------------------------------------------------------
# Install tools locally.
# ---------------------------------------------------------
.PHONY: install-tools
.SILENT: install-tools
install-tools:
sudo apt install -y nmap
curl -sS https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
chmod 755 msfinstall
./msfinstall
rm ./msfinstall
msfdb init
# ---------------------------------------------------------
# Load environment variables and secrets.
# ---------------------------------------------------------
.PHONY: print-dot-env-files-used
.SILENT: print-dot-env-files-used
# Load the specified environment variables file.
ENV_FILE ?= .env.local
include $(ENV_FILE)
# Load the specified secrets file.
SECRETS_FILE ?= .env.local.secrets
include $(SECRETS_FILE)
# Set the Docker Compose profile to "all" if an argument is not provided.
DOCKER_COMPOSE_PROFILE ?= all
print-dot-env-files-used:
@echo "[+] Set environment variables using $(ENV_FILE) and $(SECRETS_FILE)"
# ---------------------------------------------------------
# Build the containers.
# ---------------------------------------------------------
.PHONY: build
.SILENT: build
build: print-dot-env-files-used
docker compose --profile $(DOCKER_COMPOSE_PROFILE) --env-file $(ENV_FILE) --env-file $(SECRETS_FILE) build --no-cache
# ---------------------------------------------------------
# Start the containers.
# ---------------------------------------------------------
.PHONY: start
.SILENT: start
start: print-dot-env-files-used
docker compose --profile $(DOCKER_COMPOSE_PROFILE) --env-file $(ENV_FILE) --env-file $(SECRETS_FILE) up -d
# ---------------------------------------------------------
# Stop the containers.
# ---------------------------------------------------------
.PHONY: stop
.SILENT: stop
stop: print-dot-env-files-used
docker compose --profile $(DOCKER_COMPOSE_PROFILE) --env-file $(ENV_FILE) --env-file $(SECRETS_FILE) down