Browse Source

Update to terraform 0.10.3

Added arm, arm64 and windows dockerfiles
Changes to dockerfile should reduce size
Update to readme for extra badges (same as drone-plugins)
Should just need to uncomment and fix tags to auto-publish to docker hub
pull/53/head
Joachim Hill-Grannec 8 years ago
parent
commit
5e577232e4
  1. 105
      .drone.yml
  2. 27
      Dockerfile
  3. 21
      Dockerfile.arm
  4. 21
      Dockerfile.arm64
  5. 13
      Dockerfile.windows
  6. 6
      README.md

105
.drone.yml

@ -1,12 +1,109 @@
workspace:
base: /go
path: src/github.com/drone-plugins/drone-terraform
path: src/github.com/jmccann/drone-terraform
pipeline:
test:
image: golang:1.8
image: golang:1.9
pull: true
commands:
- go vet
- go test -cover -coverprofile=coverage.out
build_linux_amd64:
image: golang:1.9
pull: true
group: build
environment:
- GOOS=linux
- GOARCH=amd64
- CGO_ENABLED=0
commands:
- go test -cover -coverprofile=coverage.out
- go build -ldflags "-s -w -X main.revision=$(git rev-parse HEAD)" -a
- go build -v -ldflags "-X main.revision=$(git rev-parse HEAD)" -a -o release/linux/amd64/${DRONE_REPO_NAME}
# build_linux_arm64:
# image: golang:1.9
# pull: true
# group: build
# environment:
# - GOOS=linux
# - GOARCH=arm64
# - CGO_ENABLED=0
# commands:
# - go build -v -ldflags "-X main.revision=$(git rev-parse HEAD)" -a -o release/linux/arm64/${DRONE_REPO_NAME}
build_linux_arm:
image: golang:1.9
pull: true
group: build
environment:
- GOOS=linux
- GOARCH=arm
- CGO_ENABLED=0
- GOARM=7
commands:
- go build -v -ldflags "-X main.revision=$(git rev-parse HEAD)" -a -o release/linux/arm/${DRONE_REPO_NAME}
# build_windows_amd64:
# image: golang:1.9-nanoserver
# pull: true
# group: build
# environment:
# - GOOS=windows
# - GOARCH=amd64
# - CGO_ENABLED=0
# commands:
# - go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/windows/amd64/${DRONE_REPO_NAME}
# publish_linux_amd64:
# image: plugins/docker:17.05
# pull: true
# repo: jmccann/${DRONE_REPO_NAME}
# tags: [ latest, 1.0.0, 1.0, 1 ]
# secrets: [ docker_username, docker_password ]
# dockerfile: Dockerfile
# when:
# branch: master
# event: push
# publish_linux_arm64:
# image: plugins/docker:17.05
# pull: true
# repo: jmccann/${DRONE_REPO_NAME}
# tags: [ linux-arm64 ]
# secrets: [ docker_username, docker_password ]
# dockerfile: Dockerfile.arm64
# when:
# branch: master
# event: push
#
# publish_linux_arm:
# image: plugins/docker:17.05
# pull: true
# repo: jmccann/${DRONE_REPO_NAME}
# tags: [ linux-arm ]
# secrets: [ docker_username, docker_password ]
# dockerfile: Dockerfile.arm
# when:
# branch: master
# event: push
# publish_windows_amd64:
# image: plugins/docker:17.05
# pull: true
# repo: jmccann/${DRONE_REPO_NAME}
# tags: [ windows-amd64 ]
# secrets: [ docker_username, docker_password ]
# dockerfile: Dockerfile.windows
# when:
# branch: master
# event: push
# microbadger:
# image: plugins/webhook:1
# pull: true
# secrets: [ webhook_url ]
# when:
# branch: master
# event: push
# status: [ success ]

27
Dockerfile

@ -1,19 +1,26 @@
# Docker image for the Drone Terraform plugin
#
# docker build --rm=true -t jmccann/drone-terraform:latest .
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates git wget
FROM alpine:3.4
RUN apk -U add \
ca-certificates \
git \
wget && \
rm -rf /var/cache/apk/*
ENV TERRAFORM_VERSION 0.9.11
ENV TERRAFORM_VERSION 0.10.3
RUN wget -q https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -O terraform.zip && \
unzip terraform.zip -d /bin && \
rm -f terraform.zip
ADD drone-terraform /bin/
FROM scratch
ENV GODEBUG=netdns=go
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=alpine /bin/terraform /bin/terraform
LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/jmccann/drone-terraform.git"
LABEL org.label-schema.name="Drone Terraform"
LABEL org.label-schema.vendor="jmccann"
ADD release/linux/amd64/drone-terraform /bin/
ENTRYPOINT ["/bin/drone-terraform"]

21
Dockerfile.arm

@ -0,0 +1,21 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates git wget
ENV TERRAFORM_VERSION 0.10.3
RUN wget -q https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_arm.zip -O terraform.zip && \
unzip terraform.zip -d /bin && \
rm -f terraform.zip
FROM scratch
ENV GODEBUG=netdns=go
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/jmccann/drone-terraform.git"
LABEL org.label-schema.name="Drone Terraform"
LABEL org.label-schema.vendor="jmccann"
ADD release/linux/arm/drone-terraform /bin/
ENTRYPOINT ["/bin/drone-terraform"]

21
Dockerfile.arm64

@ -0,0 +1,21 @@
FROM alpine:3.6 as alpine
RUN apk add -U --no-cache ca-certificates
ENV TERRAFORM_VERSION 0.10.3
RUN wget -q https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_arm.zip -O terraform.zip && \
unzip terraform.zip -d /bin && \
rm -f terraform.zip
FROM scratch
ENV GODEBUG=netdns=go
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/jmccann/drone-terraform.git"
LABEL org.label-schema.name="Drone Terraform"
LABEL org.label-schema.vendor="jmccann"
ADD release/linux/arm64/drone-terraform /bin/
ENTRYPOINT ["/bin/drone-terraform"]

13
Dockerfile.windows

@ -0,0 +1,13 @@
FROM microsoft/nanoserver:latest
ENV GODEBUG=netdns=go
ENV TERRAFORM_VERSION 0.10.3
LABEL org.label-schema.version=latest
LABEL org.label-schema.vcs-url="https://github.com/jmccann/drone-terraform.git"
LABEL org.label-schema.name="Drone Terraform"
LABEL org.label-schema.vendor="jmccann"
ADD release/windows/amd64/drone-terraform /bin/
ENTRYPOINT [ "/bin/drone-terraform" ]

6
README.md

@ -1,6 +1,10 @@
# drone-terraform
[![Build Status](http://beta.drone.io/api/badges/jmccann/drone-terraform/status.svg)](http://beta.drone.io/jmccann/drone-terraform)
[![Join the chat at https://gitter.im/drone/drone](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/drone/drone)
[![Go Doc](https://godoc.org/github.com/jmccann/drone-terraform?status.svg)](http://godoc.org/github.com/jmccann/drone-terraform)
[![Go Report](https://goreportcard.com/badge/github.com/jmccann/drone-terraform)](https://goreportcard.com/report/github.com/jmccann/drone-terraform)
[![](https://images.microbadger.com/badges/image/jmccann/drone-terraform.svg)](https://microbadger.com/images/jmccann/drone-terraform "Get your own image badge on microbadger.com")
Drone plugin to execute Terraform plan and apply. For the usage information and
a listing of the available options please take a look at [the docs](DOCS.md).
@ -19,7 +23,7 @@ go test
Build the docker image with the following commands:
```
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o release/linux/amd64/drone-terraform
docker build --rm=true -t jmccann/drone-terraform .
```

Loading…
Cancel
Save