Skip to content

Commit fed6186

Browse files
authored
Update to Alpine 3.19/Go 1.22/CoreDNS 1.8.7 (#129)
1 parent c1db6f7 commit fed6186

File tree

5 files changed

+60
-60
lines changed

5 files changed

+60
-60
lines changed

Dockerfile

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,51 @@
1-
ARG BUILD_FROM
2-
3-
FROM --platform=amd64 golang:1.15-alpine3.13 AS builder
4-
5-
WORKDIR /usr/src
6-
ARG BUILD_ARCH
7-
ARG COREDNS_VERSION
8-
9-
# Build CoreDNS
10-
COPY plugins plugins
11-
RUN \
12-
set -x \
13-
&& apk add --no-cache \
14-
git \
15-
make \
16-
bash \
17-
&& git clone --depth 1 -b v${COREDNS_VERSION} https://github.com/coredns/coredns \
18-
&& cp -rf plugins/* coredns/plugin/ \
19-
&& cd coredns \
20-
&& sed -i "/^template:template/d" plugin.cfg \
21-
&& sed -i "/^hosts:.*/a template:template" plugin.cfg \
22-
&& sed -i "/^forward:.*/i fallback:fallback" plugin.cfg \
23-
&& sed -i "/^hosts:.*/a mdns:mdns" plugin.cfg \
24-
&& sed -i "/route53:route53/d" plugin.cfg \
25-
&& sed -i "/clouddns:clouddns/d" plugin.cfg \
26-
&& sed -i "/k8s_external:k8s_external/d" plugin.cfg \
27-
&& sed -i "/kubernetes:kubernetes/d" plugin.cfg \
28-
&& sed -i "/etcd:etcd/d" plugin.cfg \
29-
&& sed -i "/grpc:grpc/d" plugin.cfg \
30-
&& go generate \
31-
&& \
32-
if [ "${BUILD_ARCH}" = "armhf" ]; then \
33-
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARM=6 GOARCH=arm"; \
34-
elif [ "${BUILD_ARCH}" = "armv7" ]; then \
35-
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARM=7 GOARCH=arm"; \
36-
elif [ "${BUILD_ARCH}" = "aarch64" ]; then \
37-
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARCH=arm64"; \
38-
elif [ "${BUILD_ARCH}" = "i386" ]; then \
39-
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARCH=386"; \
40-
elif [ "${BUILD_ARCH}" = "amd64" ]; then \
41-
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARCH=amd64"; \
42-
else \
43-
exit 1; \
44-
fi
45-
46-
FROM ${BUILD_FROM}
47-
48-
WORKDIR /config
49-
COPY --from=builder /usr/src/coredns/coredns /usr/bin/coredns
50-
COPY rootfs /
1+
ARG BUILD_FROM
2+
3+
FROM --platform=amd64 golang:1.22-alpine3.19 AS builder
4+
5+
WORKDIR /usr/src
6+
ARG BUILD_ARCH
7+
ARG COREDNS_VERSION
8+
9+
# Build CoreDNS
10+
COPY plugins plugins
11+
RUN \
12+
set -x \
13+
&& apk add --no-cache \
14+
git \
15+
make \
16+
bash \
17+
&& git clone --depth 1 -b v${COREDNS_VERSION} https://github.com/coredns/coredns \
18+
&& cp -rf plugins/* coredns/plugin/ \
19+
&& cd coredns \
20+
&& sed -i "/^template:template/d" plugin.cfg \
21+
&& sed -i "/^hosts:.*/a template:template" plugin.cfg \
22+
&& sed -i "/^forward:.*/i fallback:fallback" plugin.cfg \
23+
&& sed -i "/^hosts:.*/a mdns:mdns" plugin.cfg \
24+
&& sed -i "/route53:route53/d" plugin.cfg \
25+
&& sed -i "/clouddns:clouddns/d" plugin.cfg \
26+
&& sed -i "/k8s_external:k8s_external/d" plugin.cfg \
27+
&& sed -i "/kubernetes:kubernetes/d" plugin.cfg \
28+
&& sed -i "/etcd:etcd/d" plugin.cfg \
29+
&& sed -i "/grpc:grpc/d" plugin.cfg \
30+
&& go mod tidy \
31+
&& go generate \
32+
&& \
33+
if [ "${BUILD_ARCH}" = "armhf" ]; then \
34+
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARM=6 GOARCH=arm"; \
35+
elif [ "${BUILD_ARCH}" = "armv7" ]; then \
36+
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARM=7 GOARCH=arm"; \
37+
elif [ "${BUILD_ARCH}" = "aarch64" ]; then \
38+
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARCH=arm64"; \
39+
elif [ "${BUILD_ARCH}" = "i386" ]; then \
40+
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARCH=386"; \
41+
elif [ "${BUILD_ARCH}" = "amd64" ]; then \
42+
make coredns SYSTEM="CGO_ENABLED=0 GOOS=linux GOARCH=amd64"; \
43+
else \
44+
exit 1; \
45+
fi
46+
47+
FROM ${BUILD_FROM}
48+
49+
WORKDIR /config
50+
COPY --from=builder /usr/src/coredns/coredns /usr/bin/coredns
51+
COPY rootfs /

build.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
image: ghcr.io/home-assistant/{arch}-hassio-dns
22
build_from:
3-
aarch64: ghcr.io/home-assistant/aarch64-base:3.17
4-
armhf: ghcr.io/home-assistant/armhf-base:3.17
5-
armv7: ghcr.io/home-assistant/armv7-base:3.17
6-
amd64: ghcr.io/home-assistant/amd64-base:3.17
7-
i386: ghcr.io/home-assistant/i386-base:3.17
3+
aarch64: ghcr.io/home-assistant/aarch64-base:3.19
4+
armhf: ghcr.io/home-assistant/armhf-base:3.19
5+
armv7: ghcr.io/home-assistant/armv7-base:3.19
6+
amd64: ghcr.io/home-assistant/amd64-base:3.19
7+
i386: ghcr.io/home-assistant/i386-base:3.19
88
codenotary:
99
signer: notary@home-assistant.io
1010
base_image: notary@home-assistant.io
@@ -21,4 +21,4 @@ labels:
2121
org.opencontainers.image.documentation: https://www.home-assistant.io/docs/
2222
org.opencontainers.image.licenses: Apache License 2.0
2323
args:
24-
COREDNS_VERSION: 1.8.4
24+
COREDNS_VERSION: 1.8.7

plugins/fallback/fallback.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package fallback
33

44
import (
5-
"golang.org/x/net/context"
5+
"context"
66

77
"github.com/coredns/coredns/plugin"
88
"github.com/coredns/coredns/plugin/pkg/nonwriter"

plugins/fallback/fallback_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package fallback
22

33
import (
4+
"context"
45
"testing"
56

6-
"golang.org/x/net/context"
7-
87
"github.com/coredns/coredns/plugin/pkg/dnstest"
98
"github.com/coredns/coredns/plugin/test"
109

plugins/mdns/mdns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package mdns
22

33
import (
4+
"context"
45
"net"
56
"strings"
67
"syscall"
@@ -11,7 +12,6 @@ import (
1112
"github.com/coredns/coredns/request"
1213

1314
"github.com/miekg/dns"
14-
"golang.org/x/net/context"
1515
)
1616

1717
var log = clog.NewWithPlugin("mdns")

0 commit comments

Comments
 (0)