-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (41 loc) · 1.54 KB
/
Dockerfile
File metadata and controls
47 lines (41 loc) · 1.54 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
# build command:
# docker buildx build --platform linux/amd64,linux/arm64 -t coredns-omada --load
#
# push command:
# docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io/dougbw/coredns_omada:1.4.3 -t ghcr.io/dougbw/coredns_omada:latest --push .
#
# How to setup multi platform builder:
# docker buildx create --name multiplatform
# docker buildx use multiplatform
# docker buildx inspect --bootstrap
FROM --platform=$BUILDPLATFORM golang:1.25-bookworm as builder
ARG TARGETOS TARGETARCH
RUN apt update
RUN apt install git curl jq -y
COPY . /coredns_omada
WORKDIR /
# clone latest coredns release
RUN /coredns_omada/scripts/clone-coredns.sh
# insert plugin config
RUN sed -i '/^route53:route53$/i omada:github.com/dougbw/coredns_omada' /coredns/plugin.cfg
RUN echo "replace github.com/dougbw/coredns_omada => /coredns_omada" >> /coredns/go.mod
# compile coredns
WORKDIR /coredns
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make
FROM --platform=$BUILDPLATFORM debian:stable-slim as certificates
RUN export DEBCONF_NONINTERACTIVE_SEEN=true \
DEBIAN_FRONTEND=noninteractive \
DEBIAN_PRIORITY=critical \
TERM=linux ; \
apt-get -qq update ; \
apt-get -yyqq upgrade ; \
apt-get -yyqq install ca-certificates ; \
apt-get clean
FROM --platform=$TARGETPLATFORM scratch
COPY --from=certificates /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /coredns/coredns /coredns
COPY Corefile /Corefile
EXPOSE 53 53/udp
ENV OMADA_IGNORE_STARTUP_ERRORS=FALSE
ENV FALLTHROUGH_ZONES="."
ENTRYPOINT ["/coredns"]