Skip to content

Instantly share code, notes, and snippets.

@akihiro
Created October 10, 2018 05:21
Show Gist options
  • Save akihiro/2fadb7a8acc0f21fdd7a55024c79187b to your computer and use it in GitHub Desktop.
Save akihiro/2fadb7a8acc0f21fdd7a55024c79187b to your computer and use it in GitHub Desktop.
small nsd-4.1.25 Dockerfile
FROM buildpack-deps:stretch
ARG VERSION=4.1.25
WORKDIR /usr/src
RUN gpg --recv-keys 9F6F1C2D7E045F8D
RUN curl -sSLO https://www.nlnetlabs.nl/downloads/nsd/nsd-${VERSION}.tar.gz.asc
RUN curl -sSLO https://www.nlnetlabs.nl/downloads/nsd/nsd-${VERSION}.tar.gz
RUN gpg --verify nsd-${VERSION}.tar.gz.asc nsd-${VERSION}.tar.gz
RUN tar xzf nsd-${VERSION}.tar.gz
WORKDIR /usr/src/nsd-${VERSION}
RUN ./configure --enable-pie --enable-relro-now --enable-recvmmsg --enable-ratelimit
RUN make
RUN make DESTDIR=/chroot install
RUN mv /chroot/usr/local/sbin /chroot/ && rm -rf /chroot/usr/local
RUN echo /lib64 > /chroot/etc/ld.so.conf && mkdir /chroot/lib64
RUN cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 \
/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 \
/usr/lib/x86_64-linux-gnu/libevent-2.0.so.5 \
/lib/x86_64-linux-gnu/libnss_compat.so.2 \
/lib/x86_64-linux-gnu/libnss_dns.so.2 \
/lib/x86_64-linux-gnu/libnss_files.so.2 \
/lib/x86_64-linux-gnu/libc.so.6 \
/lib/x86_64-linux-gnu/libdl.so.2 \
/lib/x86_64-linux-gnu/libpthread.so.0 \
/lib64/ld-linux-x86-64.so.2 \
/chroot/lib64
RUN ldconfig --ignore-aux-cache --verbose -f etc/ld.so.conf -r /chroot/
RUN cp /chroot/etc/nsd/nsd.conf.sample /chroot/etc/nsd/nsd.conf
RUN useradd --system nsd
RUN cp -a /etc/passwd /etc/shadow /chroot/etc
RUN chmod 1777 /chroot/tmp /chroot/var/db/nsd /chroot/var/run
FROM scratch
COPY --from=0 /chroot /
CMD ["/sbin/nsd", "-d"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment