Newer
Older
FROM debian:bullseye-slim
# Environment
ENV BUILD_PKGS \
autoconf \
automake \
gcc \
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
RUN autoreconf -if && \
CFLAGS="-g -O2 -DNDEBUG -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
./configure --prefix=/ \
--with-rundir=/rundir \
--with-storage=/storage \
--with-configdir=/config \
--with-module-dnstap=yes \
--${FASTPARSER}-fastparser \
--enable-dnstap \
--disable-static \
--disable-documentation && \
make -j$(grep -c ^processor /proc/cpuinfo)
# Run unittests if requested and install the project
ARG CHECK=disable
RUN if [ "$CHECK" = "enable" ]; then make -j$(grep -c ^processor /proc/cpuinfo) check; fi && \
make install DESTDIR=/tmp/knot-install
FROM debian:bullseye-slim
MAINTAINER Knot DNS <knot-dns@labs.nic.cz>
libfstrm0 \
libgnutls30 \
libidn2-0 \
liblmdb0 \
libmaxminddb0 \
# Copy artifacts
COPY --from=0 /tmp/knot-install/ /
# Install dependencies and create knot user and group
ARG UID=53
RUN apt-get update && \
apt-get install -yqq ${RUNTIME_PKGS} && \
rm -rf /var/lib/apt/lists/* && \
ldconfig && \
adduser --quiet --system --group --no-create-home --home /storage --uid=${UID} knot && \
chown knot:knot /config /rundir /storage
# Prepare shared directories
VOLUME /config
VOLUME /rundir
VOLUME /storage