浏览代码

Made Dockerfile improvements

Denis Waßmann 7 年之前
父节点
当前提交
39caf5506e
共有 1 个文件被更改,包括 25 次插入2 次删除
  1. 25 2
      Dockerfile

+ 25 - 2
Dockerfile

@@ -1,4 +1,4 @@
-FROM debian:latest
+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 \
@@ -19,6 +19,29 @@ 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"]