FROM alpine:3.20

RUN apk add --no-cache unbound

# Default config location; mount your own unbound.conf over this
COPY /etc/unbound/unbound.conf /etc/unbound/unbound.conf

# Unbound needs write access to its run/chroot dirs
RUN mkdir -p /var/lib/unbound && \
    unbound-anchor -a /var/lib/unbound/root.key || true

EXPOSE 53/udp 53/tcp

ENTRYPOINT ["unbound", "-d", "-c", "/etc/unbound/unbound.conf"]

