FROM debian RUN apt-get update -y && apt-get install -y \ build-essential git cmake libpcap-dev libjsoncpp-dev wget libssl-dev libreadline-dev pkg-config WORKDIR /root/build RUN wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz \ && tar xfz boost_1_72_0.tar.gz \ && rm boost_1_72_0.tar.gz \ && cd boost_1_72_0 \ && ./bootstrap.sh --prefix=/usr/local \ && ./b2 -j$(nproc) install \ && cd .. \ && rm -rf boost_1_72_0 # Build and install libtins RUN git clone https://github.com/mfontanini/libtins.git \ && cd libtins && git checkout v4.2 \ && mkdir build && cd build \ && cmake ../ -DLIBTINS_ENABLE_CXX11=1 && make -j$(nproc) && make install \ && cd ../.. && rm -rf libtins # Build and install googletest RUN git clone https://github.com/google/googletest.git \ && cd googletest \ && mkdir build && cd build \ && cmake .. && make -j$(nproc) && make install \ && cd ../.. && rm -rf googletest # Copy all required data into image COPY .cmake_modules/ /root/build/.cmake_modules RUN mkdir -p /root/build/daemon/build /root/build/cli/build # Daemon COPY /daemon/include /root/build/daemon/include COPY /daemon/src /root/build/daemon/src COPY /daemon/test /root/build/daemon/test COPY /daemon/CMakeLists.txt /root/build/daemon/ # CLI COPY /cli/include /root/build/cli/include COPY /cli/src /root/build/cli/src COPY /cli/test /root/build/cli/test COPY /cli/CMakeLists.txt /root/build/cli/ # Create Daemon config # must be located in WORKDIR because running the container will set this as default dir, so all other scripts are also run from there RUN mkdir /root/build/files \ && touch /root/build/config.txt \ && echo "port=1234" >> /root/build/config.txt \ && echo "interface=lo" >> /root/build/config.txt \ && echo "userdatabase=userStorage.txt" >> /root/build/config.txt \ && echo "filedirectory=./files/" >> /root/build/config.txt \ && echo "activateCovertChannel=false" >> /root/build/config.txt # Compile daemon RUN cd daemon/build && cmake -DENABLE_TESTS=true .. && make -j$(nproc) \ && rm -rf ../src ../include ../test ../CMakeLists.txt \ && rm -rf CMakeFiles Makefile CMakeCache.txt cmake_install.cmake \ CTestTestfile.cmake # Compile ccats with tests RUN cd cli/build && cmake -DENABLE_TESTS=true .. && make -j$(nproc) \ && rm -rf ../src ../include ../test ../CMakeLists.txt \ && rm -rf CMakeFiles Makefile CMakeCache.txt cmake_install.cmake \ CTestTestfile.cmake ENTRYPOINT /root/build/daemon/build/bin/ccats