blob: 939da81e9fc50c055acd11365e31ac7857c02245 [file] [log] [blame]
Sébastien Blin55be5da2024-02-12 11:29:54 -05001FROM ubuntu:22.04 AS build
Adrien Béraud57ea6142023-06-02 08:37:07 -04002
Sébastien Blin55be5da2024-02-12 11:29:54 -05003RUN apt-get update && apt-get install -y \
4 dialog apt-utils \
5 && apt-get clean \
6 && echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
Adrien Béraud57ea6142023-06-02 08:37:07 -04007
Sébastien Blin55be5da2024-02-12 11:29:54 -05008RUN apt-get update && apt-get install -y \
9 build-essential pkg-config cmake git wget \
10 libtool autotools-dev autoconf \
11 cython3 python3-dev python3-setuptools python3-build python3-virtualenv \
12 libncurses5-dev libreadline-dev nettle-dev libcppunit-dev \
13 libgnutls28-dev libuv1-dev libjsoncpp-dev libargon2-dev libunistring-dev \
14 libssl-dev libfmt-dev libhttp-parser-dev libasio-dev libmsgpack-dev libyaml-cpp-dev \
15 && apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
Adrien Béraud57ea6142023-06-02 08:37:07 -040016
17COPY . dhtnet
18
Sébastien Blin55be5da2024-02-12 11:29:54 -050019WORKDIR dhtnet
Adrien Béraud57ea6142023-06-02 08:37:07 -040020
Sébastien Blin55be5da2024-02-12 11:29:54 -050021RUN git submodule update --init --recursive
22
23RUN mkdir build_dev && cd build_dev \
24 && cmake .. -DBUILD_DEPENDENCIES=On -DCMAKE_INSTALL_PREFIX=/usr \
25 && make -j && make install
26
27FROM build AS test
28
29RUN apt-get update && apt-get install gcovr lcov -y
30
31RUN cd build_dev \
32 && cmake -DBUILD_TESTING=On -DCODE_COVERAGE=On .. \
33 && make -j \
34 && ctest -T Test -T Coverage \
35 && ctest -T coverage > /result.summary
36
37# Generate HTML report
38RUN cd build_dev/CMakeFiles/dhtnet.dir \
Sébastien Bline853f502024-02-12 15:56:39 -050039 && lcov --capture --no-external --directory /dhtnet --output-file coverage.info \
40 && mkdir /coverage \
41 && genhtml coverage.info --output-directory /coverage