forked from malice-plugins/bitdefender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (50 loc) · 2.19 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
REPO=malice-plugins/bitdefender
ORG=malice
NAME=bitdefender
VERSION=$(shell cat VERSION)
BDKEY?=$(shell cat bd.key)
all: build size test avtest gotest
build:
docker build --build-arg BDKEY=${BDKEY} -t $(ORG)/$(NAME):$(VERSION) .
base:
docker build -f Dockerfile.base -t $(ORG)/$(NAME):base .
dev:
docker build --build-arg BDKEY=${BDKEY} -f Dockerfile.dev -t $(ORG)/$(NAME):$(VERSION) .
size:
sed -i.bu 's/docker%20image-.*-blue/docker%20image-$(shell docker images --format "{{.Size}}" $(ORG)/$(NAME):$(VERSION)| cut -d' ' -f1)-blue/' README.md
tags:
docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.Size}}" $(ORG)/$(NAME)
ssh:
@docker run --init -it --rm --entrypoint=bash $(ORG)/$(NAME):$(VERSION)
tar:
docker save $(ORG)/$(NAME):$(VERSION) -o $(NAME).tar
gotest:
go get
go test -v
avtest:
@echo "===> ${NAME} EICAR Test"
@docker run --init --rm --entrypoint=sh $(ORG)/$(NAME):$(VERSION) -c "bdscan /malware/EICAR" > tests/av_scan.out || true
update:
@docker run --init --rm $(ORG)/$(NAME):$(VERSION) -V update
test:
docker run --init -d --name elasticsearch -p 9200:9200 blacktop/elasticsearch
sleep 10; docker run --init --rm $(ORG)/$(NAME):$(VERSION)
docker run --init --rm --link elasticsearch $(ORG)/$(NAME):$(VERSION) -V EICAR | jq . > docs/results.json
cat docs/results.json | jq .
http localhost:9200/malice/_search | jq . > docs/elastic.json
cat docs/elastic.json | jq -r '.hits.hits[] ._source.plugins.av.${NAME}.markdown' > docs/SAMPLE.md
docker rm -f elasticsearch
circle: ci-size
@sed -i.bu 's/docker%20image-.*-blue/docker%20image-$(shell cat .circleci/SIZE)-blue/' README.md
@echo "===> Image size is: $(shell cat .circleci/SIZE)"
ci-build:
@echo "===> Getting CircleCI build number"
@http https://circleci.com/api/v1.1/project/github/${REPO} | jq '.[0].build_num' > .circleci/build_num
ci-size: ci-build
@echo "===> Getting image build size from CircleCI"
@http "$(shell http https://circleci.com/api/v1.1/project/github/${REPO}/$(shell cat .circleci/build_num)/artifacts${CIRCLE_TOKEN} | jq '.[].url')" > .circleci/SIZE
clean:
docker-clean stop
docker rmi $(ORG)/$(NAME):$(VERSION)
docker rmi $(ORG)/$(NAME):base
.PHONY: build dev size tags test gotest clean circle