From 59f754d9104fc9421a9c7b05b9214b9a4eeadc07 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 30 Jan 2018 23:26:44 +0100 Subject: [PATCH] Add custom build of coredns --- Dockerfile | 20 ++++++++++++++++++++ build.sh | 25 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 Dockerfile create mode 100644 build.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2d5dc3e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM golang:alpine + +ADD ./build.sh /usr/local/bin/build.sh +RUN set -ex \ + && apk --no-cache add git bash \ + && bash /usr/local/bin/build.sh + +FROM alpine + +LABEL maintainer Knut Ahlers + +COPY --from=0 /go/bin/coredns /usr/local/bin/ + +ADD . /src +WORKDIR /src + +EXPOSE 53/udp + +ENTRYPOINT ["/usr/local/bin/coredns"] +CMD ["--"] diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..8e8c123 --- /dev/null +++ b/build.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -euxo pipefail + +IFS=$'\n' + +GOPKGS=( + 'github.com/coredns/coredns' + 'github.com/Luzifer/alias' +) + +for pkg in ${GOPKGS[@]}; do + go get -d -v "${pkg}" +done + +PLUGINS=( + '/^file:file/ i alias:github.com/Luzifer/alias' +) + +cd /go/src/github.com/coredns/coredns +for insert in ${PLUGINS[@]}; do + sed -i "${insert}" plugin.cfg +done + +go generate +go install