Dockerfile 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. FROM debian:stretch AS build-container
  2. # install all the necessary packages (see readme.md, but libpcap-dev might not be on that list, it's still needed)
  3. RUN apt-get update && apt-get install -y --no-install-recommends build-essential cmake libboost-dev libboost-python-dev libtins-dev libpcap-dev python3-dev sqlite3 \
  4. python3-pip python3-scapy python3-numpy python3-matplotlib python3-scipy python3-setuptools
  5. RUN pip3 install lea # for some reason you cant install lea via apt
  6. # make the required directored to copy the files into
  7. RUN mkdir /id2t /id2t/code /id2t/code_boost /id2t/resources
  8. WORKDIR /id2t
  9. # copy all the necessary files
  10. # there are multiple commands because docker only copies the directories' contents and not the directory itself and dont know what else to do here
  11. COPY build.sh /id2t/
  12. COPY code/ /id2t/code/
  13. COPY code_boost/ /id2t/code_boost/
  14. COPY resources /id2t/resources
  15. # run the build-script
  16. RUN ./build.sh
  17. # use a smaller container for later execution
  18. # we use python 3.6 because it's the first which comes with stretch
  19. FROM python:3.6-slim-stretch
  20. # install required libraries
  21. RUN pip3 install scapy-python3 lea numpy matplotlib scipy
  22. # create and use future work directory, don't copy code_boost
  23. RUN mkdir /id2t /id2t/code /id2t/resources
  24. WORKDIR /id2t
  25. # copy the built project
  26. COPY --from=build-container /id2t /id2t
  27. # copy the libs libpcapreader is linked with
  28. # kinda hacky, but we can do it because both containers share the same os-version
  29. COPY --from=build-container /usr/lib/x86_64-linux-gnu/libboost_python-py35.so.1.62.0 /usr/lib/libtins.so.3.4 \
  30. /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0 /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 \
  31. /usr/lib/x86_64-linux-gnu/
  32. # install tcpdump because it somehow is a requirement (id2t throws a warning otherwise)
  33. RUN apt-get update && apt-get install -y tcpdump libpcap0.8 \
  34. && rm -rf /var/lib/apt/lists/*
  35. # add id2t to the path
  36. ENV PATH="$PATH:/id2t"
  37. # start with a shell instead of python
  38. CMD ["bash"]