22 lines
761 B
Docker
22 lines
761 B
Docker
# SPDX-License-Identifier: MIT
|
|
# Copyright (C) 2026 Bryan Joshua Pedini
|
|
|
|
FROM golang:1.26-alpine AS build
|
|
RUN apk add --no-cache git ca-certificates
|
|
ARG COREDNS_VERSION
|
|
RUN test -n "$COREDNS_VERSION"
|
|
RUN git clone --depth 1 --branch "v${COREDNS_VERSION}" https://github.com/coredns/coredns.git /src
|
|
WORKDIR /src
|
|
RUN sed -i '/^file:file$/i mysql:github.com/cloud66-oss/coredns_mysql' plugin.cfg
|
|
ARG MYSQL_PLUGIN_REV
|
|
RUN test -n "$MYSQL_PLUGIN_REV"
|
|
RUN go get "github.com/cloud66-oss/coredns_mysql@${MYSQL_PLUGIN_REV}"
|
|
RUN go generate
|
|
RUN CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o /coredns .
|
|
|
|
FROM scratch
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
COPY --from=build /coredns /coredns
|
|
EXPOSE 53 53/udp
|
|
ENTRYPOINT ["/coredns"]
|