yara-python icon indicating copy to clipboard operation
yara-python copied to clipboard

compile in docker multistage

Open garanews opened this issue 4 years ago • 1 comments

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 avatar Jun 17 '21 10:06 garanews

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

garanews avatar Jun 17 '21 16:06 garanews