Browse Source

add in the k8s plugin

pull/78/head
Chris Mague 6 years ago
parent
commit
797a0dd6ec
  1. 40
      Dockerfile

40
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"]

Loading…
Cancel
Save