-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (36 loc) · 1.7 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (36 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
FROM ubuntu:24.04 AS base
RUN apt-get update && apt-get install -y \
dialog apt-utils \
&& apt-get clean \
&& echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update && apt-get install -y \
build-essential pkg-config cmake git wget \
libtool autotools-dev autoconf \
cython3 python3-dev python3-setuptools python3-build python3-virtualenv \
libncurses5-dev libreadline-dev nettle-dev libcppunit-dev \
libgnutls28-dev libuv1-dev libjsoncpp-dev libargon2-dev libunistring-dev \
libssl-dev libfmt-dev libasio-dev libmsgpack-cxx-dev libyaml-cpp-dev \
libupnp-dev libnatpmp-dev \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
COPY . dhtnet
WORKDIR dhtnet
RUN git submodule update --init --recursive
FROM base AS build
RUN mkdir build_dev && cd build_dev \
&& cmake .. -DBUILD_DEPENDENCIES=On -DCMAKE_INSTALL_PREFIX=/usr
RUN cd build_dev \
&& make -j$(nproc) && make install
FROM build AS test
RUN apt-get update && apt-get install gcovr lcov -y
RUN cd build_dev \
&& cmake -DBUILD_TESTING=On -DCODE_COVERAGE=On .. \
&& make -j$(nproc) \
&& ctest -T Test
# Generate coverage only from the main library (not tests and dependencies)
# TODO: figure out why lcov is throwing inconsitency and negative errors. For now, ignore those errors.
RUN cd build_dev \
&& lcov --capture --directory ./CMakeFiles/dhtnet.dir/src --output-file coverage_all.info --ignore-errors inconsistent,negative \
&& lcov --extract coverage_all.info '/dhtnet/src/*' --output-file coverage.info \
&& lcov --list coverage.info > /result.summary \
&& mkdir -p /coverage \
&& genhtml coverage.info --output-directory /coverage