From 7d1e39a8e01c89162fde8ff57a3a29c31a7726e9 Mon Sep 17 00:00:00 2001 From: Jacob McCann Date: Fri, 12 Jul 2019 07:55:47 -0500 Subject: [PATCH] chore: some improvements to build automation --- Dockerfile | 6 +++++- build-docker.sh | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9f167df..fefaf4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,9 +7,13 @@ RUN apk add --no-cache git RUN mkdir -p /tmp/drone-terraform WORKDIR /tmp/drone-terraform -COPY . . +COPY go.mod go.mod +COPY go.sum go.sum RUN go mod download + +COPY . . + RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o /go/bin/drone-terraform FROM alpine:3.9 diff --git a/build-docker.sh b/build-docker.sh index 369f928..46b6753 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + tag=$1 if [ -z $tag ]; then @@ -25,9 +27,9 @@ if [[ "$ans" != "Y" && "$ans" != "y" ]]; then exit 0 fi +set -x docker build -t jmccann/drone-terraform:latest . -set -x docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major} docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major}.${minor} docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major}.${minor}-${tf_ver}