-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (48 loc) · 1.99 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
#!make
include .env
export
MAKEFLAGS += --always-make
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
%:
@:
_env:
ifeq ($(wildcard .env),)
cp .env.dist .env
endif
########################################################################################################################
owner: ## Reset folder owner
sudo chown --changes -R $$(whoami) ./
@echo "Success"
check-conflicts: ## Find git conflicts
@if grep -rn '^<<<\<<<< ' .; then exit 1; fi
@if grep -rn '^===\====$$' .; then exit 1; fi
@if grep -rn '^>>>\>>>> ' .; then exit 1; fi
@echo "All is OK"
check-todos: ## Find TODO's
@if grep -rn '@TO\DO:' .; then exit 1; fi
@echo "All is OK"
check-master: ## Check for latest master in current branch
@git remote update
@if ! git log --pretty=format:'%H' | grep $$(git log --pretty=format:'%H' -n 1 origin/master) > /dev/null; then exit 1; fi
@echo "All is OK"
images: _env ## Create a proxy image
docker build tor --tag $(EGND_TOR_IMAGE)$(IMG_VERSION)
docker build privoxy --tag $(EGND_PRIVOXY_IMAGE)$(IMG_VERSION)
push: images ## Create a proxy image
docker push $(EGND_TOR_IMAGE)$(IMG_VERSION)
docker push $(EGND_PRIVOXY_IMAGE)$(IMG_VERSION)
scan: images ## Scan proxy image for vulnerabilities
docker scan --dependency-tree --severity=high $(EGND_TOR_IMAGE)
docker scan --dependency-tree --severity=high $(EGND_PRIVOXY_IMAGE)
lint: ## Validate Dockerfile
docker run --rm -i ghcr.io/hadolint/hadolint:latest-alpine /bin/hadolint --ignore=DL3008 - < tor/Dockerfile
docker run --rm -i ghcr.io/hadolint/hadolint:latest-alpine /bin/hadolint --ignore=DL3008 - < privoxy/Dockerfile
compose: compose-stop ## Run services
ifeq ($(wildcard docker-compose.override.yml),)
ln -s docker-compose.build.yml docker-compose.override.yml
endif
docker-compose up --build --abort-on-container-exit --renew-anon-volumes
compose-stop: _env ## Stop services
docker-compose down --remove-orphans --volumes