From 921ba5415247e2f6ca247e3c63967d204d9799e7 Mon Sep 17 00:00:00 2001 From: Andrey Arapov Date: Sat, 14 Jul 2018 15:28:38 +0200 Subject: [PATCH] use multi-stage build --- Dockerfile | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index cebc06c6..07677802 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,18 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM golang:1.10-alpine - -VOLUME /config -EXPOSE 6060 6061 - +FROM golang:1.10-alpine AS build ADD . /go/src/github.com/coreos/clair/ WORKDIR /go/src/github.com/coreos/clair/ +RUN go build github.com/coreos/clair/cmd/clair -RUN apk add --no-cache git rpm xz dumb-init && \ - go install -v github.com/coreos/clair/cmd/clair && \ - mv /go/bin/clair /clair && \ - rm -rf /go /usr/local/go - +FROM alpine:3.8 +COPY --from=build /go/src/github.com/coreos/clair/clair /clair +RUN apk add --no-cache git rpm xz ca-certificates dumb-init ENTRYPOINT ["/usr/bin/dumb-init", "--", "/clair"] - +VOLUME /config +EXPOSE 6060 6061