mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-12-03 14:50:39 +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,4 +1,4 @@
|
||||||
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
|
||||||
|
@ -9,7 +9,8 @@ RUN apk --no-cache add \
|
||||||
|
|
||||||
ENV COREDNS_VERSION v1.2.2
|
ENV COREDNS_VERSION v1.2.2
|
||||||
|
|
||||||
RUN buildDeps=' \
|
RUN set -x \
|
||||||
|
&& apk --no-cache add \
|
||||||
go \
|
go \
|
||||||
git \
|
git \
|
||||||
gcc \
|
gcc \
|
||||||
|
@ -17,16 +18,14 @@ RUN buildDeps=' \
|
||||||
libc-dev \
|
libc-dev \
|
||||||
libgcc \
|
libgcc \
|
||||||
make \
|
make \
|
||||||
' \
|
|
||||||
set -x \
|
|
||||||
&& apk --no-cache add $buildDeps \
|
|
||||||
&& git clone --depth 1 --branch ${COREDNS_VERSION} https://github.com/coredns/coredns /go/src/github.com/coredns/coredns \
|
&& git clone --depth 1 --branch ${COREDNS_VERSION} https://github.com/coredns/coredns /go/src/github.com/coredns/coredns \
|
||||||
&& cd /go/src/github.com/coredns/coredns \
|
&& cd /go/src/github.com/coredns/coredns \
|
||||||
&& make CHECKS="godeps" \
|
&& make CHECKS="godeps" \
|
||||||
&& mv coredns /usr/bin/coredns \
|
&& mv coredns /usr/bin/coredns \
|
||||||
&& apk del $buildDeps \
|
|
||||||
&& rm -rf /go \
|
|
||||||
&& echo "Build complete."
|
&& 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