ARG BUILD_FROM=ghcr.io/hassio-addons/debian-base:9.2.0
# hadolint ignore=DL3006
FROM ${BUILD_FROM}

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG COREDNS_VERSION=1.14.3

WORKDIR /coredns

RUN apt-get update \
    && apt-get install -y ca-certificates libcap2-bin \
    && apt-get clean \
    && curl -sSL -o coredns.tgz \
      https://github.com/coredns/coredns/releases/download/v${COREDNS_VERSION}/coredns_${COREDNS_VERSION}_linux_amd64.tgz  \
    && tar -xvf coredns.tgz \
    && chmod +x coredns

LABEL \
    org.opencontainers.image.title="CoreDNS Add-on" \
    org.opencontainers.image.description="CoreDNS server for Home Assistant" \
    org.opencontainers.image.url="https://coredns.io" \
    org.opencontainers.image.source="https://github.com/coredns/coredns" \
    org.opencontainers.image.documentation="https://coredns.io/manual"

COPY rootfs /
