fix terraform

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
Jess Frazelle 2018-07-06 11:09:04 -04:00
parent abfd4b6e02
commit 3642ff5129
No known key found for this signature in database
GPG Key ID: C0B444E6A3EFD4C1

View File

@ -1,35 +1,35 @@
FROM alpine:latest
LABEL maintainer "Sid Carter <me@sidcarter.com>"
FROM golang:alpine as builder
MAINTAINER Jessica Frazelle <jess@linux.com>
ENV PATH /go/bin:/usr/local/go/bin:$PATH
ENV GOPATH /go
RUN apk --no-cache add \
ca-certificates
RUN apk add --no-cache \
bash \
ca-certificates \
git \
make \
zip
ENV TERRAFORM_VERSION v0.11.7
RUN buildDeps=' \
bash \
go \
git \
gcc \
g++ \
libc-dev \
libgcc \
make \
' \
set -x \
&& apk --no-cache add --repository https://dl-3.alpinelinux.org/alpine/edge/community $buildDeps \
&& mkdir -p /go/src/github.com/hashicorp /etc/terraform.d \
&& git clone --depth 1 --branch ${TERRAFORM_VERSION} https://github.com/hashicorp/terraform /go/src/github.com/hashicorp/terraform \
&& cd /go/src/github.com/hashicorp/terraform \
&& CGO_ENABLED=0 XC_ARCH="amd64" XC_OS="linux" make fmt bin \
&& mv bin/terraform /usr/bin/terraform \
&& apk del $buildDeps \
&& rm -rf /go \
&& echo "Build complete."
RUN go get github.com/hashicorp/terraform
WORKDIR /go/src/github.com/hashicorp/terraform
RUN git checkout "${TERRAFORM_VERSION}"
# Install the vendor packages so stringer works.
# See: https://github.com/golang/go/issues/10249
RUN go install ./vendor/...
RUN XC_ARCH="amd64" XC_OS="linux" LD_FLAGS=" -extldflags -static" make bin \
&& mv bin/terraform /usr/bin/terraform
FROM scratch
COPY --from=builder /usr/bin/terraform /usr/bin/terraform
COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs
ENTRYPOINT [ "terraform" ]
CMD [ "--help" ]