Dockerfile.testing 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. FROM debian
  2. RUN apt-get update -y && apt-get install -y \
  3. build-essential git cmake libpcap-dev libjsoncpp-dev wget libssl-dev libreadline-dev pkg-config
  4. WORKDIR /root/build
  5. RUN wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz \
  6. && tar xfz boost_1_72_0.tar.gz \
  7. && rm boost_1_72_0.tar.gz \
  8. && cd boost_1_72_0 \
  9. && ./bootstrap.sh --prefix=/usr/local \
  10. && ./b2 -j$(nproc) install \
  11. && cd .. \
  12. && rm -rf boost_1_72_0
  13. # Build and install libtins
  14. RUN git clone https://github.com/mfontanini/libtins.git \
  15. && cd libtins && git checkout v4.2 \
  16. && mkdir build && cd build \
  17. && cmake ../ -DLIBTINS_ENABLE_CXX11=1 && make -j$(nproc) && make install \
  18. && cd ../.. && rm -rf libtins
  19. # Build and install googletest
  20. RUN git clone https://github.com/google/googletest.git \
  21. && cd googletest \
  22. && mkdir build && cd build \
  23. && cmake .. && make -j$(nproc) && make install \
  24. && cd ../.. && rm -rf googletest
  25. # Copy all required data into image
  26. COPY .cmake_modules/ /root/build/.cmake_modules
  27. RUN mkdir -p /root/build/daemon/build /root/build/cli/build
  28. # Daemon
  29. COPY /daemon/include /root/build/daemon/include
  30. COPY /daemon/src /root/build/daemon/src
  31. COPY /daemon/test /root/build/daemon/test
  32. COPY /daemon/CMakeLists.txt /root/build/daemon/
  33. # CLI
  34. COPY /cli/include /root/build/cli/include
  35. COPY /cli/src /root/build/cli/src
  36. COPY /cli/test /root/build/cli/test
  37. COPY /cli/CMakeLists.txt /root/build/cli/
  38. # Create Daemon config
  39. # must be located in WORKDIR because running the container will set this as default dir, so all other scripts are also run from there
  40. RUN mkdir /root/build/files \
  41. && touch /root/build/config.txt \
  42. && echo "port=1234" >> /root/build/config.txt \
  43. && echo "interface=lo" >> /root/build/config.txt \
  44. && echo "userdatabase=userStorage.txt" >> /root/build/config.txt \
  45. && echo "filedirectory=./files/" >> /root/build/config.txt \
  46. && echo "activateCovertChannel=false" >> /root/build/config.txt
  47. # Compile daemon
  48. RUN cd daemon/build && cmake -DENABLE_TESTS=true .. && make -j$(nproc) \
  49. && rm -rf ../src ../include ../test ../CMakeLists.txt \
  50. && rm -rf CMakeFiles Makefile CMakeCache.txt cmake_install.cmake \
  51. CTestTestfile.cmake
  52. # Compile ccats with tests
  53. RUN cd cli/build && cmake -DENABLE_TESTS=true .. && make -j$(nproc) \
  54. && rm -rf ../src ../include ../test ../CMakeLists.txt \
  55. && rm -rf CMakeFiles Makefile CMakeCache.txt cmake_install.cmake \
  56. CTestTestfile.cmake
  57. ENTRYPOINT /root/build/daemon/build/bin/ccats