-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
102 lines (89 loc) · 2.67 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
ORG_FILE := organization.json
CONF_FILE := config.conf
WARNING_HOURS := 48
DOCKER_GOOGLE_FLAG := $(shell echo $${GOOGLE_APPLICATION_CREDENTIALS:+-v ${GOOGLE_APPLICATION_CREDENTIALS}:/google-creds -e GOOGLE_APPLICATION_CREDENTIALS=/google-creds})
CONTAINER_TAG := cloudsweeper
build:
docker build -t $(CONTAINER_TAG) .
clean-build:
docker image rm $(CONTAINER_TAG)
push: build
docker push $(CONTAINER_TAG):latest
run: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
-v $(shell pwd)/$(ORG_FILE):/$(ORG_FILE) \
-v $(shell pwd)/$(CONF_FILE):/$(CONF_FILE) \
--rm $(CONTAINER_TAG)
cleanup: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
-v $(shell pwd)/$(ORG_FILE):/$(ORG_FILE) \
-v $(shell pwd)/$(CONF_FILE):/$(CONF_FILE) \
--rm $(CONTAINER_TAG) cleanup
reset: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
-v $(shell pwd)/$(ORG_FILE):/$(ORG_FILE) \
-v $(shell pwd)/$(CONF_FILE):/$(CONF_FILE) \
--rm $(CONTAINER_TAG) reset
review: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
-v $(shell pwd)/$(ORG_FILE):/$(ORG_FILE) \
-v $(shell pwd)/$(CONF_FILE):/$(CONF_FILE) \
--rm $(CONTAINER_TAG) review
mark: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
--rm $(CONTAINER_TAG) mark-for-cleanup
warn: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
-v $(shell pwd)/$(ORG_FILE):/$(ORG_FILE) \
-v $(shell pwd)/$(CONF_FILE):/$(CONF_FILE) \
--rm $(CONTAINER_TAG) warn
untagged: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
-v $(shell pwd)/$(ORG_FILE):/$(ORG_FILE) \
-v $(shell pwd)/$(CONF_FILE):/$(CONF_FILE) \
--rm $(CONTAINER_TAG) find-untagged
billing-report: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
-v $(shell pwd)/$(ORG_FILE):/$(ORG_FILE) \
-v $(shell pwd)/$(CONF_FILE):/$(CONF_FILE) \
--rm $(CONTAINER_TAG) billing-report
find: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
-v $(shell pwd)/$(ORG_FILE):/$(ORG_FILE) \
-v $(shell pwd)/$(CONF_FILE):/$(CONF_FILE) \
--rm $(CONTAINER_TAG) --resource-id=$(RESOURCE_ID) find-resource
setup: build
docker run \
-e AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY \
$(DOCKER_GOOGLE_FLAG) \
-v $(shell pwd)/$(ORG_FILE):/$(ORG_FILE) \
-v $(shell pwd)/$(CONF_FILE):/$(CONF_FILE) \
--rm -it $(CONTAINER_TAG) setup