Use pre_build hook in docker hub to build the coredns binary (#799)

and skip the download process.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2017-07-27 14:34:56 -07:00
committed by GitHub
parent 10d354b784
commit 64353d8f3b
4 changed files with 8 additions and 20 deletions

View File

@@ -8,7 +8,7 @@ all: coredns
# TODO: Add .go file dependencies.
.PHONY: coredns
coredns: check godeps
go build $(BUILD_VERBOSE) -ldflags="-s -w"
CGO_ENABLED=0 go build $(BUILD_VERBOSE) -ldflags="-s -w"
.PHONY: deps
deps: core/zmiddleware.go core/dnsserver/zdirectives.go godeps

View File

@@ -1,16 +0,0 @@
FROM alpine:latest
MAINTAINER Miek Gieben <miek@coredns.io> @miekg
# only need ca-certificates & openssl if want to use https_google
RUN apk --update add bind-tools ca-certificates openssl && update-ca-certificates && rm -rf /var/cache/apk/*
ARG COREDNS_VERSION=latest
RUN echo build coredns v$COREDNS_VERSION
ADD https://github.com/coredns/coredns/releases/download/v${COREDNS_VERSION}/coredns_${COREDNS_VERSION}_linux_x86_64.tgz /
RUN tar -xzf coredns_${COREDNS_VERSION}_linux_x86_64.tgz && rm coredns_${COREDNS_VERSION}_linux_x86_64.tgz
EXPOSE 53 53/udp
ENTRYPOINT ["/coredns"]

View File

@@ -1,3 +0,0 @@
#!/bin/sh
set -x
docker build --build-arg COREDNS_VERSION=$SOURCE_BRANCH -t $IMAGE_NAME .

7
hooks/pre_build Normal file
View File

@@ -0,0 +1,7 @@
#!/bin/sh
echo "=> Building the CoreDNS binary"
docker run \
-v $(pwd):/go/src/github.com/coredns/coredns \
-w /go/src/github.com/coredns/coredns \
golang:1.8.0 \
make