-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
73 lines (66 loc) · 1.79 KB
/
Dockerfile
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
FROM malice/alpine
LABEL maintainer "https://github.com/blacktop"
LABEL malice.plugin.repository = "https://github.com/malice-plugins/yara.git"
LABEL malice.plugin.category="av"
LABEL malice.plugin.mime="*"
LABEL malice.plugin.docker.engine="*"
ENV YARA 3.9.0
# Install Yara
RUN apk --update add --no-cache openssl file bison jansson ca-certificates
RUN apk --update add --no-cache -t .build-deps \
openssl-dev \
jansson-dev \
build-base \
libc-dev \
file-dev \
automake \
autoconf \
libtool \
flex \
git \
gcc \
&& echo "===> Install Yara from source..." \
&& cd /tmp \
&& git clone --recursive --branch v${YARA} https://github.com/VirusTotal/yara.git \
&& cd /tmp/yara \
&& ./bootstrap.sh \
&& sync \
&& ./configure --enable-magic \
--enable-cuckoo \
--enable-dotnet \
&& make \
&& make install \
&& rm -rf /tmp/* \
&& apk del --purge .build-deps
# Install malice plugin
COPY . /go/src/github.com/maliceio/malice-yara
RUN apk --update add --no-cache -t .build-deps \
openssl-dev \
jansson-dev \
build-base \
mercurial \
musl-dev \
openssl \
bash \
wget \
git \
gcc \
dep \
go \
&& echo "===> Building scan Go binary..." \
&& cd /go/src/github.com/maliceio/malice-yara \
&& echo " * copy yara rules" \
&& mkdir /rules \
&& mv rules /rules \
&& export GOPATH=/go \
&& export CGO_CFLAGS="-I/usr/local/include" \
&& export CGO_LDFLAGS="-L/usr/local/lib -lyara" \
&& export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" \
&& go version \
&& dep ensure \
&& CGO_ENABLED=1 go build -ldflags "-s -w -X main.Version=v$(cat VERSION) -X main.BuildTime=$(date -u +%Y%m%d)" -o /bin/scan \
&& rm -rf /go /usr/local/go /usr/lib/go /tmp/* \
&& apk del --purge .build-deps
WORKDIR /malware
ENTRYPOINT ["su-exec","malice","scan"]
CMD ["--help"]