From 4f529a880992b5808d13f824260637456d72b42b Mon Sep 17 00:00:00 2001 From: Calin Don Date: Fri, 21 Jul 2017 18:42:39 +0300 Subject: [PATCH] Build using Dockerfile multistage feature --- Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b62e4ba..b2296f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,12 @@ # Docker image for the Drone Terraform plugin # # docker build --rm=true -t jmccann/drone-terraform:latest . +FROM golang:1.8-alpine AS builder +COPY . . +RUN set -ex \ + && apk add --no-cache git \ + && go-wrapper download \ + && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo FROM alpine:3.4 @@ -15,5 +21,5 @@ RUN wget -q https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraf unzip terraform.zip -d /bin && \ rm -f terraform.zip -ADD drone-terraform /bin/ +COPY --from=/go/src/app/drone-terraform /bin/ ENTRYPOINT ["/bin/drone-terraform"]