0
0
mirror of https://github.com/thegeeklab/wp-opentofu.git synced 2024-11-25 09:40:39 +00:00

Merge pull request #99 from trevorah/tf-build-args

move terraform version to a docker build arg
This commit is contained in:
Jacob McCann 2019-08-05 12:49:31 -05:00 committed by GitHub
commit 20808a4a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View File

@ -25,8 +25,8 @@ RUN apk -U add \
openssh-client && \ openssh-client && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ENV TERRAFORM_VERSION 0.12.4 ARG terraform_version
RUN wget -q https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -O terraform.zip && \ RUN wget -q https://releases.hashicorp.com/terraform/${terraform_version}/terraform_${terraform_version}_linux_amd64.zip -O terraform.zip && \
unzip terraform.zip -d /bin && \ unzip terraform.zip -d /bin && \
rm -f terraform.zip rm -f terraform.zip

View File

@ -21,7 +21,9 @@ go build
Build the docker image with the following commands: Build the docker image with the following commands:
``` ```
docker build --rm=true -t jmccann/drone-terraform . docker build --rm=true \
-t jmccann/drone-terraform \
--build-arg terraform_version=0.12.0 .
``` ```
## Usage ## Usage

View File

@ -13,7 +13,7 @@ major=$(echo $tag | awk -F. '{print $1}')
minor=$(echo $tag | awk -F. '{print $2}') minor=$(echo $tag | awk -F. '{print $2}')
# patch=$(echo $tag | awk -F. '{print $3}') # patch=$(echo $tag | awk -F. '{print $3}')
tf_ver=$(grep TERRAFORM_VERSION Dockerfile | head -n 1 | awk '{print $3}') tf_ver="0.12.4"
echo "Confirm building images for:" echo "Confirm building images for:"
echo " MAJOR: ${major}" echo " MAJOR: ${major}"
@ -28,7 +28,7 @@ if [[ "$ans" != "Y" && "$ans" != "y" ]]; then
fi fi
set -x set -x
docker build -t jmccann/drone-terraform:latest . docker build -t jmccann/drone-terraform:latest --build-arg terraform_version=${tf_ver} .
docker tag jmccann/drone-terraform:latest jmccann/drone-terraform:${major} 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}