FROM ghcr.io/hassio-addons/debian-base:9.5.2

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

ARG COREDNS_VERSION=1.15.0

WORKDIR /coredns

RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates \
    && apt-get clean \
    && curl -fsSL -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 \
    && rm -rf coredns.tgz /var/lib/apt/lists/*

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 /
