VirusTotal / yara-python

The Python interface for YARA
http://virustotal.github.io/yara/
Apache License 2.0
646 stars 179 forks source link

compile in docker multistage #180

Open garanews opened 3 years ago

garanews commented 3 years ago

Hello, would like to know what are the right lib to copy after compiled yara && yara-python from sources.

FROM base-builder as yara-builder
RUN cd /tmp/ \
  && git clone --recursive https://github.com/VirusTotal/yara.git \
..
..
&& make install \
..
  && git clone --recursive https://github.com/VirusTotal/yara-python \
..
...
  && python setup.py install \

at the end :

COPY --from=yara-builder /usr/local/lib/python3.8/site-packages/yara_python-4.1.0-py3.8-linux-x86_64.egg /usr/local/lib/python3.8/site-packages/yara_python-4.1.0-py3.8-linux-x86_64.egg
COPY --from=yara-builder /usr/local/lib/libyara* /usr/local/lib/

but if I try in python to import yara I get ModuleNotFoundError: No module named 'yara' (Instead if I try inside docker image to follow same step I used to compile, it works with any issue)

There is any other library/file to copy from compiler stage to the final stage? Thanks

garanews commented 3 years ago

Current "workaround I found" is launch install in the final stage:

COPY --from=yara-builder  /tmp/yara-python/ /tmp/
RUN  cd /tmp/ \
&& python setup.py install