diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000000..d485a7dcafa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# This Dockerfile builds on golang:alpine by building Terraform from source +# using the current working directory. +# +# This produces a docker image that contains a working Terraform binary along +# with all of its source code, which is what gets released on hub.docker.com +# as terraform:full. The main releases (terraform:latest, terraform:light and +# the release tags) are lighter images including only the officially-released +# binary from releases.hashicorp.com; these are built instead from +# scripts/docker-release/Dockerfile-release. + +FROM golang:1.11-alpine +LABEL maintainer="HashiCorp Terraform Team " + +RUN apk add --update git bash openssh make gcc musl-dev + +ENV TF_DEV=true +ENV TF_RELEASE=1 + +WORKDIR $GOPATH/src/github.com/terraform-providers/terraform-provider-aws +COPY . . +RUN make fmt && make build && make test + +WORKDIR $GOPATH +ENTRYPOINT ["terraform"] diff --git a/build-in-docker.sh b/build-in-docker.sh new file mode 100755 index 00000000000..cfc4e73159d --- /dev/null +++ b/build-in-docker.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -e + +VERSION=$1 +if [ -z "$VERSION" ]; then + echo "Provide the Terraform provider version number as an argument" + exit -1 +fi + +IMAGE_NAME=terraform-provider-aws-build +docker -D build -t $IMAGE_NAME . +docker run -v $(pwd):/opt/project -e VERSION=${VERSION} -e GIT_SHORT_HASH=$(git rev-parse --short HEAD) --entrypoint /bin/ash $IMAGE_NAME /opt/project/copy-build-output.sh diff --git a/copy-build-output.sh b/copy-build-output.sh new file mode 100644 index 00000000000..12c165c8a21 --- /dev/null +++ b/copy-build-output.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +OUTPUT_DIR=${VERSION}_patched_${GIT_SHORT_HASH}/linux_amd64 +mkdir -p /opt/project/${OUTPUT_DIR} +cp /go/bin/terraform-provider-aws /opt/project/${OUTPUT_DIR}/terraform-provider-aws_$VERSION +cd /opt/project/${OUTPUT_DIR} +sha256sum terraform-provider-aws_$VERSION > SHA256SUMS \ No newline at end of file