unbound/Dockerfile

30 lines
995 B
Docker

FROM alpine:3.15.5
ARG UNBOUND_VERSION=1.21.0
# Install dependencies and build unbound, clean up after
RUN apk --update add --no-cache alpine-sdk bison dns-root-hints expat-dev flex git openssl-dev && \
# Clone at given tag and build Unbound from source (https://github.com/NLnetLabs/unbound)
git clone --depth 1 --branch "release-${UNBOUND_VERSION}" https://github.com/NLnetLabs/unbound.git /tmp/unbound && \
cd /tmp/unbound && \
./configure && \
make && \
make install && \
# Clean up build dependencies
make clean && \
cd /srv && \
rm -rf /tmp/* && \
apk del alpine-sdk bison expat-dev flex git openssl-dev
# Prepare image
COPY entrypoint.sh /srv/
COPY healthcheck.sh /srv/
# Prepare unbound
RUN addgroup -S unbound && adduser -S -G unbound unbound
RUN mkdir -p /srv/unbound/conf
COPY unbound.conf /srv/unbound/unbound.conf
HEALTHCHECK --interval=10s --timeout=1s --retries=1 CMD sh /srv/healthcheck.sh
ENTRYPOINT ["sh", "/srv/entrypoint.sh"]