1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- FROM debian:stretch AS build-container
- # install all the necessary packages (see readme.md, but libpcap-dev might not be on that list, it's still needed)
- 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 \
- python3-pip python3-scapy python3-numpy python3-matplotlib python3-scipy python3-setuptools
- RUN pip3 install lea # for some reason you cant install lea via apt
- # make the required directored to copy the files into
- RUN mkdir /id2t /id2t/code /id2t/code_boost /id2t/resources
- WORKDIR /id2t
- # copy all the necessary files
- # there are multiple commands because docker only copies the directories' contents and not the directory itself and dont know what else to do here
- COPY build.sh /id2t/
- COPY code/ /id2t/code/
- COPY code_boost/ /id2t/code_boost/
- COPY resources /id2t/resources
- # run the build-script
- RUN ./build.sh
- # use a smaller container for later execution
- # we use python 3.6 because it's the first which comes with stretch
- FROM python:3.6-slim-stretch
- # install required libraries
- RUN pip3 install scapy-python3 lea numpy matplotlib scipy
- # create and use future work directory, don't copy code_boost
- RUN mkdir /id2t /id2t/code /id2t/resources
- WORKDIR /id2t
- # copy the built project
- COPY --from=build-container /id2t /id2t
- # copy the libs libpcapreader is linked with
- # kinda hacky, but we can do it because both containers share the same os-version
- COPY --from=build-container /usr/lib/x86_64-linux-gnu/libboost_python-py35.so.1.62.0 /usr/lib/libtins.so.3.4 \
- /usr/lib/x86_64-linux-gnu/libpython3.5m.so.1.0 /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 \
- /usr/lib/x86_64-linux-gnu/
- # install tcpdump because it somehow is a requirement (id2t throws a warning otherwise)
- RUN apt-get update && apt-get install -y tcpdump libpcap0.8 \
- && rm -rf /var/lib/apt/lists/*
- # add id2t to the path
- ENV PATH="$PATH:/id2t"
- # start with a shell instead of python
- CMD ["bash"]
|