-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.cli
49 lines (45 loc) · 1.81 KB
/
Dockerfile.cli
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
FROM debian AS container-metrics
RUN apt-get update && apt-get install -y \
curl \
git \
libbson-dev \
libmagic1 \
libmongoc-dev \
python3 \
python3-pip \
python3-venv
RUN python3 -m venv /home/container-metrics/venv
RUN . /home/container-metrics/venv/bin/activate && pip3 install \
alive-progress \
bitarray \
bson \
dict2xml \
jmespath-community \
matplotlib \
pymongo \
python-magic \
&& deactivate
# jp executable
RUN curl -Lo /home/container-metrics/jp \
https://github.com/jmespath-community/jp/releases/latest/download/jp-linux-amd64 \
&& chmod +x /home/container-metrics/jp
# yara (custom build using './src/yara_patch/*')
RUN git clone --recursive https://github.com/VirusTotal/yara-python
COPY ./src/yara_module /yara-python/yara/libyara/modules/cm
COPY ./patches/yara.patch /yara.patch
RUN cd /yara-python/yara && git apply /yara.patch
COPY ./patches/yara-python.patch /yara-python.patch
RUN cd /yara-python && git apply /yara-python.patch
RUN . /home/container-metrics/venv/bin/activate && cd /yara-python \
&& python3 setup.py build && python3 setup.py install && deactivate
# create entrypoint
RUN echo "#!/bin/bash">/home/entrypoint.sh
RUN echo ". /home/container-metrics/venv/bin/activate">>/home/entrypoint.sh
RUN echo "python3 -u /home/container-metrics/container_metrics.py \"\$@\"">>/home/entrypoint.sh
RUN echo "err_level=\$?">>/home/entrypoint.sh
RUN echo "deactivate">>/home/entrypoint.sh
RUN echo "exit \$err_level">>/home/entrypoint.sh
RUN chmod +x /home/entrypoint.sh
WORKDIR /home/container-metrics
COPY ./src /home/container-metrics/
ENTRYPOINT [ "/home/entrypoint.sh" ]