-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmakefile
More file actions
59 lines (50 loc) · 1.86 KB
/
makefile
File metadata and controls
59 lines (50 loc) · 1.86 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
# Define variables
TEAM_NAME := mfoster
VERSION := 0.1.1
APPLICATIONS:= dvwa juice-shop log4shell nodejs-goof-vuln-main rce-exploit rce-http-exploit webgoat frontend payment-processor database
MANIFEST_DIR ?= app-images
update:
@echo "Updating image tags in Kubernetes manifests in $(MANIFEST_DIR)"
@find $(MANIFEST_DIR) -type f \( -name "*.yaml" -o -name "*.yml" \) | while read -r file; do \
echo "Processing $$file"; \
sed -E 's|\(quay\.io/mfoster/vulnerable-demo-applications:[^:]*:\)[0-9]+$$|\1$(VERSION)|' $$file; \
echo "Updated image tags in $$file"; \
done
@echo "All relevant manifest files in $(MANIFEST_DIR) have been updated to use version: $(VERSION)"
build-images:
for component in $(APPLICATIONS); do \
( cd app-images/$${component}; \
echo "Building $$component..."; \
podman build --platform linux/amd64,linux/arm64 \
-t quay.io/$(TEAM_NAME)/$${component}:$(VERSION) . || exit 1; \
echo "Pushing $$component..."; \
podman push quay.io/$(TEAM_NAME)/$${component}:$(VERSION) || exit 1; \
); \
done; \
build:
@if [ -z "$(COMPONENT)" ]; then \
echo "Error: Please specify a COMPONENT to build (e.g., make build COMPONENT=example)."; \
exit 1; \
fi
cd app-images/$(COMPONENT); \
podman build --platform linux/amd64,linux/arm64 \
-t quay.io/$(TEAM_NAME)/$(COMPONENT):$(VERSION) . ; \
podman push quay.io/$(TEAM_NAME)/$(COMPONENT):$(VERSION) ;
rm-all-containers:
podman rm $$(podman ps -a -q)
rm-all-images:
podman rmi -f $$(podman images -aq)
push-images:
for component in $(APPLICATIONS); do \
echo "Pushing $$component..."; \
podman push quay.io/$(TEAM_NAME)/$${component}:$(VERSION) || exit 1; \
done; \
build-tag-and-push:
make build-images
make push-images
pull:
for component in $(APPLICATIONS); do \
( cd app-images/$${component}; \
podman pull quay.io/$(TEAM_NAME)/$${component}:$(VERSION) \
); \
done; \