mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 11:31:49 +01:00
make coredns/Dockerfile use build stages (#424)
* make coredns/Dockerfile use build stages This change makes the coredns Dockerfile use build stages to create the binaries which are then copied to the image for running. * removing deps
This commit is contained in:
parent
35e8964699
commit
3bfafa2f4c
|
@ -1,32 +1,31 @@
|
||||||
FROM alpine:latest
|
FROM alpine:latest as builder
|
||||||
LABEL maintainer "Jessie Frazelle <jess@linux.com>"
|
LABEL maintainer "Jessie Frazelle <jess@linux.com>"
|
||||||
|
|
||||||
ENV PATH /go/bin:/usr/local/go/bin:$PATH
|
ENV PATH /go/bin:/usr/local/go/bin:$PATH
|
||||||
ENV GOPATH /go
|
ENV GOPATH /go
|
||||||
|
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add \
|
||||||
ca-certificates
|
ca-certificates
|
||||||
|
|
||||||
ENV COREDNS_VERSION v1.2.2
|
ENV COREDNS_VERSION v1.2.2
|
||||||
|
|
||||||
RUN buildDeps=' \
|
RUN set -x \
|
||||||
go \
|
&& apk --no-cache add \
|
||||||
git \
|
go \
|
||||||
gcc \
|
git \
|
||||||
g++ \
|
gcc \
|
||||||
libc-dev \
|
g++ \
|
||||||
libgcc \
|
libc-dev \
|
||||||
make \
|
libgcc \
|
||||||
' \
|
make \
|
||||||
set -x \
|
&& git clone --depth 1 --branch ${COREDNS_VERSION} https://github.com/coredns/coredns /go/src/github.com/coredns/coredns \
|
||||||
&& apk --no-cache add $buildDeps \
|
&& cd /go/src/github.com/coredns/coredns \
|
||||||
&& git clone --depth 1 --branch ${COREDNS_VERSION} https://github.com/coredns/coredns /go/src/github.com/coredns/coredns \
|
&& make CHECKS="godeps" \
|
||||||
&& cd /go/src/github.com/coredns/coredns \
|
&& mv coredns /usr/bin/coredns \
|
||||||
&& make CHECKS="godeps" \
|
&& echo "Build complete."
|
||||||
&& mv coredns /usr/bin/coredns \
|
|
||||||
&& apk del $buildDeps \
|
|
||||||
&& rm -rf /go \
|
|
||||||
&& echo "Build complete."
|
|
||||||
|
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
COPY --from=builder /usr/bin/coredns /usr/bin/coredns
|
||||||
|
|
||||||
ENTRYPOINT [ "coredns", "-log" ]
|
ENTRYPOINT [ "coredns", "-log" ]
|
Loading…
Reference in New Issue
Block a user