Dockerfile.testing 3.0 KB

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