Skip to content
This repository has been archived by the owner on Feb 19, 2021. It is now read-only.

Commit

Permalink
Share scripts to build Linux binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlavin committed Sep 13, 2018
1 parent 1afe18f commit cfbc98a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"

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"]
13 changes: 13 additions & 0 deletions build-in-docker.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions copy-build-output.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cfbc98a

Please sign in to comment.