Dockerfile 1.48 KB
Newer Older
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
## Intermediate stage ##
FROM debian:stable-slim

# Environment
ENV BUILD_PKGS \
    autoconf \
    automake \
    gcc \
    git-core \
    libedit-dev \
    libfstrm-dev \
    libgnutls28-dev \
    libidn2-0-dev \
    liblmdb-dev \
    libmaxminddb-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
28
COPY . /knot-src
29
WORKDIR /knot-src
30
RUN autoreconf -if && \
31
    ./configure --prefix=/ \
32 33 34 35 36 37 38 39
                --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) && \
40
    make install DESTDIR=/tmp/knot-install
41 42

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

46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
# Environment
ENV RUNTIME_PKGS \
    libedit2 \
    libfstrm0 \
    libgnutls30 \
    libidn2-0 \
    liblmdb0 \
    libmaxminddb0 \
    libprotobuf-c1 \
    liburcu4

# 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
65 66

# Expose port
67 68
EXPOSE 53/UDP
EXPOSE 53/TCP
69

70 71 72 73
# Prepare shared directories
VOLUME /config
VOLUME /rundir
VOLUME /storage