git subrepo clone https://github.com/mailcow/mailcow-dockerized.git mailcow/src/mailcow-dockerized

subrepo: subdir:   "mailcow/src/mailcow-dockerized"
  merged:   "a832becb"
upstream: origin:   "https://github.com/mailcow/mailcow-dockerized.git"
  branch:   "master"
  commit:   "a832becb"
git-subrepo: version:  "0.4.3"
  origin:   "???"
  commit:   "???"
Change-Id: If5be2d621a211e164c9b6577adaa7884449f16b5
diff --git a/mailcow/src/mailcow-dockerized/data/Dockerfiles/unbound/Dockerfile b/mailcow/src/mailcow-dockerized/data/Dockerfiles/unbound/Dockerfile
new file mode 100644
index 0000000..cb34e45
--- /dev/null
+++ b/mailcow/src/mailcow-dockerized/data/Dockerfiles/unbound/Dockerfile
@@ -0,0 +1,23 @@
+FROM alpine:3.11
+
+LABEL maintainer "Andre Peters <andre.peters@servercow.de>"
+
+RUN apk add --update --no-cache \
+	curl \
+	unbound \
+	bash \
+	openssl \
+	drill \
+	tzdata \
+	&& curl -o /etc/unbound/root.hints https://www.internic.net/domain/named.cache \
+	&& chown root:unbound /etc/unbound \
+  && adduser unbound tty \
+	&& chmod 775 /etc/unbound
+
+EXPOSE 53/udp 53/tcp
+
+COPY docker-entrypoint.sh /docker-entrypoint.sh
+
+ENTRYPOINT ["/docker-entrypoint.sh"]
+
+CMD ["/usr/sbin/unbound"]
diff --git a/mailcow/src/mailcow-dockerized/data/Dockerfiles/unbound/docker-entrypoint.sh b/mailcow/src/mailcow-dockerized/data/Dockerfiles/unbound/docker-entrypoint.sh
new file mode 100755
index 0000000..bb9c115
--- /dev/null
+++ b/mailcow/src/mailcow-dockerized/data/Dockerfiles/unbound/docker-entrypoint.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+echo "Setting console permissions..."
+chown root:tty /dev/console
+chmod g+rw /dev/console
+echo "Receiving anchor key..."
+/usr/sbin/unbound-anchor -a /etc/unbound/trusted-key.key
+echo "Receiving root hints..."
+curl -#o /etc/unbound/root.hints https://www.internic.net/domain/named.cache
+/usr/sbin/unbound-control-setup
+
+# Run hooks
+for file in /hooks/*; do
+  if [ -x "${file}" ]; then
+    echo "Running hook ${file}"
+    "${file}"
+  fi
+done
+
+exec "$@"