summaryrefslogtreecommitdiffstats
path: root/Dockerfile
blob: 2e8f83987bdc5d19c9449e40772f2fb2ecd124ff (plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
## Intermediate stage ##
FROM debian:bullseye-slim

# Environment
ENV BUILD_PKGS \
    autoconf \
    automake \
    gcc \
    libbpf-dev \
    libedit-dev \
    libelf-dev \
    libfstrm-dev \
    libgnutls28-dev \
    libidn2-0-dev \
    liblmdb-dev \
    libmaxminddb-dev \
    libmnl-dev \
    libnghttp2-dev \
    libprotobuf-c-dev \
    libtool \
    liburcu-dev \
    make \
    pkg-config \
    protobuf-c-compiler

# Install dependencies
RUN apt-get update && \
    apt-get install -yqq ${BUILD_PKGS}

# Build the project
COPY . /knot-src
WORKDIR /knot-src
RUN autoreconf -if && \
    ./configure --prefix=/ \
                --with-rundir=/rundir \
                --with-storage=/storage \
                --with-configdir=/config \
                --with-module-dnstap=yes \
                --disable-fastparser \
                --disable-static \
                --disable-documentation && \
    make -j$(grep -c ^processor /proc/cpuinfo) && \
    make install DESTDIR=/tmp/knot-install

## Final stage ##
FROM debian:bullseye-slim
MAINTAINER Knot DNS <knot-dns@labs.nic.cz>

# Environment
ENV RUNTIME_PKGS \
    libbpf0 \
    libedit2 \
    libelf1 \
    libfstrm0 \
    libgnutls30 \
    libidn2-0 \
    liblmdb0 \
    libmaxminddb0 \
    libmnl0 \
    libnghttp2-14 \
    libprotobuf-c1 \
    liburcu6

# Copy artifacts
COPY --from=0 /tmp/knot-install/ /

# Install dependencies
RUN apt-get update && \
    apt-get install -yqq ${RUNTIME_PKGS} && \
    rm -rf /var/lib/apt/lists/* && \
    ldconfig

# Expose port
EXPOSE 53/UDP
EXPOSE 53/TCP

# Prepare shared directories
VOLUME /config
VOLUME /rundir
VOLUME /storage