forked from data-prep-kit/data-prep-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (45 loc) · 1.86 KB
/
Dockerfile
File metadata and controls
57 lines (45 loc) · 1.86 KB
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
FROM docker.io/python:3.10.14-slim-bullseye AS base
RUN pip install --upgrade --no-cache-dir pip
# install pytest
RUN pip install --no-cache-dir pytest
RUN apt -y update \
&& apt install -y clamav-daemon \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -ms /bin/bash dpk
USER dpk
WORKDIR /home/dpk
FROM docker.io/clamav/clamav:latest AS clamav
FROM base AS clamav-local
USER root
COPY --chown=dpk:root --from=clamav /var/lib/clamav/ /var/lib/clamav/
COPY --chown=dpk:root clamd.conf /etc/clamav/clamd.conf
RUN freshclam \
&& mkdir -p /var/run/clamav \
&& chown -R dpk:root /var/run/clamav /var/log/clamav /var/lib/clamav
CMD ["/bin/bash", "-c", "clamd --debug --foreground"]
USER dpk
FROM base AS malware
COPY --chown=dpk:root --from=clamav-local /var/lib/clamav/ /var/lib/clamav/
COPY --chown=dpk:root --from=clamav-local /etc/clamav/clamd.conf /etc/clamav/clamd.conf
COPY --chown=dpk:root --from=clamav-local /var/log/clamav/clamav.log /var/log/clamav/clamav.log
COPY --chown=dpk:root --from=clamav-local /var/run/clamav /var/run/clamav
# Copy and install data processing libraries
# These are expected to be placed in the docker context before this is run (see the make image).
COPY --chown=dpk:root data-processing-lib-python/ data-processing-lib-python/
RUN cd data-processing-lib-python && pip install --no-cache-dir -e .
COPY --chown=dpk:root src/ src/
COPY --chown=dpk:root pyproject.toml pyproject.toml
RUN pip install --no-cache-dir -e .
# copy source data
COPY --chown=dpk:root ./src/malware_transform.py .
COPY --chown=dpk:root ./src/malware_transform_python.py .
COPY --chown=dpk:root ./src/malware_local.py local/
COPY test/ test/
COPY test-data/ test-data/
ENV PYTHONPATH /home/dpk
# Put these at the end since they seem to upset the docker cache.
ARG BUILD_DATE
ARG GIT_COMMIT
LABEL build-date=$BUILD_DATE
LABEL git-commit=$GIT_COMMIT