Dockerfile.testing 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. RUN mkdir -p /root/build/daemon/build /root/build/cli/build
  31. RUN mkdir -p /root/build/gui/build
  32. # Daemon
  33. COPY /daemon/include /root/build/daemon/include
  34. COPY /daemon/src /root/build/daemon/src
  35. COPY /daemon/test /root/build/daemon/test
  36. COPY /daemon/CMakeLists.txt /root/build/daemon/
  37. # CLI
  38. COPY /cli/include /root/build/cli/include
  39. COPY /cli/src /root/build/cli/src
  40. COPY /cli/test /root/build/cli/test
  41. COPY /cli/CMakeLists.txt /root/build/cli/
  42. # GUI
  43. COPY /gui/include /root/build/gui/include
  44. COPY /gui/src /root/build/gui/src
  45. COPY /gui/CMakeLists.txt /root/build/gui/
  46. # Create Daemon config
  47. # must be located in WORKDIR because running the container will set this as default dir, so all other scripts are also run from there
  48. RUN mkdir /root/build/files \
  49. && touch /root/build/config.txt \
  50. && echo "port=1234" >> /root/build/config.txt \
  51. && echo "interface=lo" >> /root/build/config.txt \
  52. && echo "userdatabase=userStorage.txt" >> /root/build/config.txt \
  53. && echo "filedirectory=./files/" >> /root/build/config.txt \
  54. && echo "activateCovertChannel=false" >> /root/build/config.txt
  55. # Compile daemon
  56. RUN cd daemon/build && cmake -DENABLE_TESTS=true .. && make -j$(nproc) \
  57. && rm -rf ../src ../include ../test ../CMakeLists.txt \
  58. && rm -rf CMakeFiles Makefile CMakeCache.txt cmake_install.cmake \
  59. CTestTestfile.cmake
  60. # Compile ccats with tests
  61. RUN cd cli/build && cmake -DENABLE_TESTS=true .. && make -j$(nproc) \
  62. && rm -rf ../src ../include ../test ../CMakeLists.txt \
  63. && rm -rf CMakeFiles Makefile CMakeCache.txt cmake_install.cmake \
  64. CTestTestfile.cmake
  65. # Compile ccats-gui
  66. RUN cd gui/build && cmake .. && make -j$(nproc) \
  67. && cd ../.. && rm -rf gui
  68. ENTRYPOINT /root/build/daemon/build/bin/ccats