Dockerfile 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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
  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. RUN mkdir /root/build/files \
  26. && touch /root/build/config.txt \
  27. && echo "port=1234" >> /root/build/config.txt \
  28. && echo "interface=lo" >> /root/build/config.txt \
  29. && echo "userdatabase=userStorage.txt" >> /root/build/config.txt \
  30. && echo "filedirectory=./files/" >> /root/build/config.txt
  31. # Copy all required data into image
  32. COPY .cmake_modules/ /root/.cmake_modules
  33. COPY libs/ /root/libs
  34. COPY /daemon/include /root/build/include
  35. COPY /daemon/src /root/build/src
  36. COPY /daemon/test /root/build/test
  37. COPY /daemon/CMakeLists.txt /root/build
  38. # Compile ccats with tests
  39. RUN cmake . && make -j$(nproc) \
  40. && rm -rf src include CMakeFiles \
  41. && rm Makefile CMakeCache.txt cmake_install.cmake CMakeLists.txt \
  42. CTestTestfile.cmake
  43. # Set entrypoint and expose port
  44. ENTRYPOINT /root/build/bin/ccats
  45. EXPOSE 1234