-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (48 loc) · 1.91 KB
/
Dockerfile
File metadata and controls
54 lines (48 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
ARG BUILD_FROM=ghcr.io/home-assistant/base:3.23-2026.03.1
FROM golang:1.25.7-alpine3.23 AS builder
WORKDIR /usr/src
ARG TARGETARCH
ARG COREDNS_VERSION="1.11.4"
# Build CoreDNS
COPY plugins plugins
RUN \
set -x \
&& apk add --no-cache \
git \
make \
bash \
&& git clone --depth 1 -b v${COREDNS_VERSION} https://github.com/coredns/coredns \
&& cp -rf plugins/* coredns/plugin/ \
&& cd coredns \
&& sed -i "/^template:template/d" plugin.cfg \
&& sed -i "/^hosts:.*/a template:template" plugin.cfg \
&& sed -i "/^forward:.*/i fallback:fallback" plugin.cfg \
&& sed -i "/^hosts:.*/a mdns:mdns" plugin.cfg \
&& sed -i "/route53:route53/d" plugin.cfg \
&& sed -i "/clouddns:clouddns/d" plugin.cfg \
&& sed -i "/k8s_external:k8s_external/d" plugin.cfg \
&& sed -i "/kubernetes:kubernetes/d" plugin.cfg \
&& sed -i "/etcd:etcd/d" plugin.cfg \
&& sed -i "/grpc:grpc/d" plugin.cfg \
&& go mod tidy \
&& go generate \
&& if [ -z "${TARGETARCH}" ]; then \
echo "TARGETARCH is not set, please use Docker BuildKit for the build." && exit 1; \
fi \
&& case "${TARGETARCH}" in \
amd64|arm64) ;; \
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \
esac \
&& make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH}"
FROM ${BUILD_FROM}
WORKDIR /config
COPY --from=builder /usr/src/coredns/coredns /usr/bin/coredns
COPY rootfs /
LABEL \
io.hass.type="dns" \
org.opencontainers.image.title="Home Assistant DNS Plugin" \
org.opencontainers.image.description="Home Assistant Supervisor plugin for DNS" \
org.opencontainers.image.authors="The Home Assistant Authors" \
org.opencontainers.image.url="https://www.home-assistant.io/" \
org.opencontainers.image.documentation="https://www.home-assistant.io/docs/" \
org.opencontainers.image.licenses="Apache License 2.0"