commit 59f754d9104fc9421a9c7b05b9214b9a4eeadc07 Author: Knut Ahlers Date: Tue Jan 30 23:26:44 2018 +0100 Add custom build of coredns 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