From 797a0dd6ec33a2dcd745ba87282fb264ad69aad9 Mon Sep 17 00:00:00 2001 From: Chris Mague Date: Fri, 24 Aug 2018 11:59:09 -0700 Subject: [PATCH] add in the k8s plugin --- Dockerfile | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3348435..5b08677 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ +################################################################################################# # Docker image for the Drone Terraform plugin # -# docker build -t jmccann/drone-terraform:latest . + + +################################################################################################# +# Build the Go binary FROM golang:1.10-alpine AS builder COPY ./*.go ./src/ COPY ./vendor/ ./src/ @@ -8,11 +12,36 @@ RUN set -ex \ && cd ./src \ && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o /go/bin/drone-terraform + +################################################################################################# +# Build the Terraform plugin +FROM golang:1.10-alpine AS tfbuilder + +RUN apk -U add \ + ca-certificates \ + git \ + bash \ + wget \ + rm -rf /var/cache/apk/* + +RUN mkdir -p /go/src/github.com/sl1pm4t \ + && cd /go/src/github.com/sl1pm4t \ + && git clone https://github.com/sl1pm4t/terraform-provider-kubernetes.git \ + && cd ./terraform-provider-kubernetes \ + && go get -v \ + && GOOS=linux GOARCH=amd64 go build -v -o /go/bin/terraform-provider-kubernetes \ + && ls -al /go/bin/terraform-provider-kubernetes + +################################################################################################# +# Build the actual container FROM alpine:3.7 RUN apk -U add \ ca-certificates \ git \ + ansible \ + jq \ + bash \ wget \ openssh-client && \ rm -rf /var/cache/apk/* @@ -24,5 +53,14 @@ RUN wget -q https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraf unzip terraform.zip -d /bin && \ rm -f terraform.zip +RUN wget -P /usr/local/bin/ https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator && \ + chmod +x /usr/local/bin/aws-iam-authenticator + +RUN wget -P /usr/local/bin/ https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/kubectl && \ + chmod +x /usr/local/bin/kubectl + +RUN mkdir -p /root/.terraform.d/plugins/ + +COPY --from=tfbuilder /go/bin/terraform-provider-kubernetes /root/.terraform.d/plugins/ COPY --from=builder /go/bin/drone-terraform /bin/ ENTRYPOINT ["/bin/drone-terraform"]