2018-11-23 03:21:48 -05:00
|
|
|
## Intermediate stage ##
|
2023-01-20 08:59:21 -05:00
|
|
|
FROM debian:bookworm-slim AS builder
|
2018-11-23 03:21:48 -05:00
|
|
|
|
|
|
|
|
# Environment
|
|
|
|
|
ENV BUILD_PKGS \
|
|
|
|
|
autoconf \
|
|
|
|
|
automake \
|
|
|
|
|
gcc \
|
2021-02-10 09:06:50 -05:00
|
|
|
libbpf-dev \
|
2018-11-23 03:21:48 -05:00
|
|
|
libedit-dev \
|
|
|
|
|
libfstrm-dev \
|
|
|
|
|
libgnutls28-dev \
|
2023-12-22 03:26:38 -05:00
|
|
|
libidn2-dev \
|
2018-11-23 03:21:48 -05:00
|
|
|
liblmdb-dev \
|
|
|
|
|
libmaxminddb-dev \
|
2021-02-23 06:29:47 -05:00
|
|
|
libmnl-dev \
|
2020-07-20 04:03:47 -04:00
|
|
|
libnghttp2-dev \
|
2023-01-20 13:18:42 -05:00
|
|
|
libngtcp2-crypto-gnutls-dev \
|
|
|
|
|
libngtcp2-dev \
|
2018-11-23 03:21:48 -05:00
|
|
|
libprotobuf-c-dev \
|
2023-07-13 07:16:16 -04:00
|
|
|
libsystemd-dev \
|
2018-11-23 03:21:48 -05:00
|
|
|
libtool \
|
|
|
|
|
liburcu-dev \
|
2023-01-20 07:50:39 -05:00
|
|
|
libxdp-dev \
|
2018-11-23 03:21:48 -05:00
|
|
|
make \
|
|
|
|
|
pkg-config \
|
|
|
|
|
protobuf-c-compiler
|
|
|
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
|
RUN apt-get update && \
|
|
|
|
|
apt-get install -yqq ${BUILD_PKGS}
|
|
|
|
|
|
|
|
|
|
# Build the project
|
2018-11-23 04:57:02 -05:00
|
|
|
COPY . /knot-src
|
2018-11-23 03:21:48 -05:00
|
|
|
WORKDIR /knot-src
|
2021-11-22 07:27:25 -05:00
|
|
|
ARG FASTPARSER=disable
|
2018-11-23 04:57:02 -05:00
|
|
|
RUN autoreconf -if && \
|
2021-11-22 07:27:25 -05:00
|
|
|
CFLAGS="-g -O2 -DNDEBUG -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
|
2018-12-10 08:04:22 -05:00
|
|
|
./configure --prefix=/ \
|
2018-11-23 03:21:48 -05:00
|
|
|
--with-rundir=/rundir \
|
|
|
|
|
--with-storage=/storage \
|
|
|
|
|
--with-configdir=/config \
|
|
|
|
|
--with-module-dnstap=yes \
|
2021-11-22 07:27:25 -05:00
|
|
|
--${FASTPARSER}-fastparser \
|
2022-08-22 11:43:12 -04:00
|
|
|
--enable-quic \
|
2021-11-22 07:27:25 -05:00
|
|
|
--enable-dnstap \
|
2018-11-23 03:21:48 -05:00
|
|
|
--disable-static \
|
|
|
|
|
--disable-documentation && \
|
2021-11-22 07:27:25 -05:00
|
|
|
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 && \
|
2018-12-10 08:04:22 -05:00
|
|
|
make install DESTDIR=/tmp/knot-install
|
2018-11-23 03:21:48 -05:00
|
|
|
|
|
|
|
|
## Final stage ##
|
2022-08-22 11:43:12 -04:00
|
|
|
FROM debian:bookworm-slim
|
2023-07-07 03:49:11 -04:00
|
|
|
LABEL maintainer="Knot DNS <knot-dns@labs.nic.cz>"
|
2015-01-02 06:52:55 -05:00
|
|
|
|
2018-11-23 03:21:48 -05:00
|
|
|
# Environment
|
|
|
|
|
ENV RUNTIME_PKGS \
|
2023-07-13 07:16:16 -04:00
|
|
|
dbus \
|
2023-01-20 07:50:39 -05:00
|
|
|
libbpf1 \
|
2018-11-23 03:21:48 -05:00
|
|
|
libedit2 \
|
|
|
|
|
libfstrm0 \
|
|
|
|
|
libgnutls30 \
|
2023-12-22 03:26:38 -05:00
|
|
|
libidn2 \
|
2018-11-23 03:21:48 -05:00
|
|
|
liblmdb0 \
|
|
|
|
|
libmaxminddb0 \
|
2021-02-23 06:29:47 -05:00
|
|
|
libmnl0 \
|
2020-07-20 04:03:47 -04:00
|
|
|
libnghttp2-14 \
|
2023-01-20 13:18:42 -05:00
|
|
|
libngtcp2-crypto-gnutls2 \
|
|
|
|
|
libngtcp2-9 \
|
2018-11-23 03:21:48 -05:00
|
|
|
libprotobuf-c1 \
|
2023-01-20 07:50:39 -05:00
|
|
|
liburcu8 \
|
|
|
|
|
libxdp1
|
2018-11-23 03:21:48 -05:00
|
|
|
|
2022-01-26 03:21:39 -05:00
|
|
|
# Install dependencies and create knot user and group
|
|
|
|
|
ARG UID=53
|
2018-11-23 03:21:48 -05:00
|
|
|
RUN apt-get update && \
|
2023-01-20 08:59:21 -05:00
|
|
|
apt-get install -yqq ${RUNTIME_PKGS} adduser && \
|
2018-11-23 03:21:48 -05:00
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
2022-01-26 03:21:39 -05:00
|
|
|
ldconfig && \
|
|
|
|
|
adduser --quiet --system --group --no-create-home --home /storage --uid=${UID} knot && \
|
2023-01-20 08:59:21 -05:00
|
|
|
install -o knot -g knot -d /config /rundir /storage
|
|
|
|
|
|
|
|
|
|
# Copy artifacts
|
2023-01-20 13:01:10 -05:00
|
|
|
# `COPY --from=builder /tmp/knot-install/ /` doesn't work with DOCKER_BUILDKIT=1 under buildx
|
|
|
|
|
COPY --from=builder /tmp/knot-install/bin/ /bin/
|
|
|
|
|
COPY --from=builder /tmp/knot-install/config/ /config/
|
|
|
|
|
COPY --from=builder /tmp/knot-install/include/ /include/
|
|
|
|
|
COPY --from=builder /tmp/knot-install/lib/ /lib/
|
|
|
|
|
COPY --from=builder /tmp/knot-install/sbin/ /sbin/
|
|
|
|
|
COPY --from=builder /tmp/knot-install/share/ /share/
|
2015-01-02 06:52:55 -05:00
|
|
|
|
2023-07-13 07:16:16 -04:00
|
|
|
# Prepare configurations for optional D-Bus signaling
|
|
|
|
|
COPY --from=builder /knot-src/distro/common/system-local.conf /etc/dbus-1/
|
|
|
|
|
COPY --from=builder /knot-src/distro/common/cz.nic.knotd.conf /usr/share/dbus-1/system.d/
|
|
|
|
|
RUN mkdir -p /run/dbus
|
|
|
|
|
|
2015-01-02 06:52:55 -05:00
|
|
|
# Expose port
|
2018-11-23 03:21:48 -05:00
|
|
|
EXPOSE 53/UDP
|
|
|
|
|
EXPOSE 53/TCP
|
2023-06-21 09:32:37 -04:00
|
|
|
EXPOSE 853/UDP
|
2015-02-03 13:26:37 -05:00
|
|
|
|
2018-11-23 03:21:48 -05:00
|
|
|
# Prepare shared directories
|
|
|
|
|
VOLUME /config
|
|
|
|
|
VOLUME /rundir
|
|
|
|
|
VOLUME /storage
|