-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (38 loc) · 1.22 KB
/
Makefile
File metadata and controls
46 lines (38 loc) · 1.22 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
# Hardcoded vaues for the containers name and aavailable resources
name="tda602_graphql"
memory="100m"
cpus="1"
# Builds the Dockerfile into an image
build:
docker build -t $(name) .
# Runs the docker container from the built image
# Runs with limited memory and cpu
# Hardcoded portforwaring on port 8080
run:
docker run --cpus=$(cpus) -m $(memory) --memory-swap=$(memory) --rm -p 8080:8080 --name $(name) $(name)
# Same as "make run", but with full access to the host system's resources
# Needed when testing the brute force password cracking with batch and alias limiting
# enabled in order to avoid having the container crash due to large amount of network
# requests.
run_unlimited:
docker run --rm -p 8080:8080 --name $(name) $(name)
# Does both build and run
app:
$(MAKE) build
$(MAKE) run
# In case --rm flag of run command did not work,
# can manually kill the container this way
kill:
docker kill $(name)
# To go inside the docker container and inspect what is actually happening
exec:
docker exec -it $(name) /bin/bash
# Kills then reruns the container from the image
rerun:
$(MAKE) kill
$(MAKE) run
# Kills, then builds an image from the Dockerfile,
# then runs a container from the image
restart:
$(MAKE) kill
$(MAKE) app