Skip to content

Commit

Permalink
⬆️ Update Terraform CLI version (#27)
Browse files Browse the repository at this point in the history
* 👷 add new tf cli version and correct image output name

* 📝 remove microbadger brocken badge and update tagging strategy

* 🐳 bumped git version and default CLI version

* 🔧 reverted dev script ability to build without args
  • Loading branch information
bgauduch authored May 14, 2020
1 parent 001e06d commit 1f89e5a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ jobs:
strategy:
matrix:
versions:
- { tf_version: "0.11.14", awscli_version: "1.18.51" }
- { tf_version: "0.12.24", awscli_version: "1.18.51" }
- { tf_version: "0.12.25", awscli_version: "1.18.59" }

env:
TF_VERSION: ${{ matrix.versions.tf_version }}
Expand All @@ -41,23 +43,26 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v2

- name: Get release tag and save in env var
- name: Get and save release tag
run: echo "::set-env name=RELEASE_TAG::${GITHUB_REF##*/}"

- name: Build and save image release tag
run: echo "::set-env name=IMAGE_RELEASE_TAG::r${RELEASE_TAG}-${IMAGE_TAG}"

- name: Build image
run: docker image build . --file Dockerfile --build-arg TERRAFORM_VERSION=$TF_VERSION --build-arg AWS_CLI_VERSION=$AWS_CLI_VERSIOIN --tag $ORGANIZATION/$IMAGE_NAME:$RELEASE_TAG-$IMAGE_TAG
run: docker image build . --file Dockerfile --build-arg TERRAFORM_VERSION=$TF_VERSION --build-arg AWS_CLI_VERSION=$AWS_CLI_VERSIOIN --tag $ORGANIZATION/$IMAGE_NAME:$IMAGE_RELEASE_TAG

- name: Login to Docker Hub registry
run: echo '${{ secrets.DOCKERHUB_PASS }}' | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin

- name: Push image to registry
run: docker push $ORGANIZATION/$IMAGE_NAME:$RELEASE_TAG-$IMAGE_TAG
run: docker push $ORGANIZATION/$IMAGE_NAME:$IMAGE_RELEASE_TAG

- name: Save image
run: docker image save -o $IMAGE_NAME-$RELEASE_TAG-$IMAGE_TAG.tar $ORGANIZATION/$IMAGE_NAME:$RELEASE_TAG-$IMAGE_TAG
run: docker image save -o $IMAGE_NAME-$IMAGE_RELEASE_TAG.tar $ORGANIZATION/$IMAGE_NAME:$IMAGE_RELEASE_TAG

- name: Upload image artifact
uses: actions/upload-artifact@v2
with:
name: ${{ env.IMAGE_NAME }}-${{ env.RELEASE_TAG }}-${{ env.IMAGE_TAG }}
path: ${{ env.IMAGE_NAME }}-${{ env.RELEASE_TAG }}-${{ env.IMAGE_TAG }}.tar
name: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_RELEASE_TAG }}
path: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_RELEASE_TAG }}.tar
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Setup build arguments with default versions
ARG AWS_CLI_VERSION=1.18.52
ARG TERRAFORM_VERSION=0.12.24
ARG AWS_CLI_VERSION=1.18.59
ARG TERRAFORM_VERSION=0.12.25
ARG PYTHON_MAJOR_VERSION=3.7

# Download Terraform binary
Expand Down Expand Up @@ -39,7 +39,7 @@ ARG PYTHON_MAJOR_VERSION
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates=20190110 \
git=1:2.20.1-2+deb10u1 \
git=1:2.20.1-2+deb10u3 \
jq=1.5+dfsg-2+b1 \
python3=${PYTHON_MAJOR_VERSION}.3-1 \
&& apt-get clean \
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[![build](https://github.com/Zenika/terraform-aws-cli/workflows/build/badge.svg)](https://github.com/Zenika/terraform-aws-cli/actions?query=workflow%3Abuild)
[![push-latest](https://github.com/Zenika/terraform-aws-cli/workflows/push-latest/badge.svg)](https://github.com/Zenika/terraform-aws-cli/actions?query=workflow%3Apush-latest)
[![release](https://github.com/Zenika/terraform-aws-cli/workflows/release/badge.svg)](https://github.com/Zenika/terraform-aws-cli/actions?query=workflow%3Arelease)
[![](https://images.microbadger.com/badges/image/zenika/terraform-aws-cli.svg)](https://microbadger.com/images/zenika/terraform-aws-cli)
[![Docker Pulls](https://img.shields.io/docker/pulls/zenika/terraform-aws-cli.svg)](https://hub.docker.com/r/zenika/terraform-aws-cli/)

# Terraform and AWS CLI Docker image
Expand All @@ -13,14 +12,13 @@ The following image tag strategy is applied:
* `zenika/terraform-aws-cli:latest` - build from master
* Included CLI versions can be found in the [Dockerfile](https://github.com/Zenika/terraform-aws-cli/blob/master/Dockerfile)
* `zenika/terraform-aws-cli:S.T-tfUU.VV.WW-awscliXX.YY.ZZ` - build from releases
* `S.T` is the release tag
* `UU.VV.WWW` is the Terraform version included in the image
* `XX.YY.ZZ` is the AWS CLI version included in the image
* `rS.T` is the release tag
* `tfUU.VV.WWW` is the Terraform version included in the image
* `awscliXX.YY.ZZ` is the AWS CLI version included in the image

Please report to the [releases page](https://github.com/Zenika/terraform-aws-cli/releases) for the changelogs. Any other tags are not supported.

## 💡 Motivation

The goal is to create a **minimalist** and **lightweight** image with these tools in order to reduce network and storage impact.

This image gives you the flexibility to be used for development or as a base image as you see fits.
Expand Down
4 changes: 2 additions & 2 deletions dev-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ if [ -n "$1" ] && [ -n "$2" ] ; then
echo "Building images with parameters AWS_CLI_VERSION=${1} and TERRAFORM_VERSION=${2}"
docker image build --build-arg AWS_CLI_VERSION="$1" --build-arg TERRAFORM_VERSION="$2" -t zenika/terraform-aws-cli:latest .
else
echo "Please provide AWS_CLI_VERSION and TERRAFORM_VERSION parameters"
echo "Usage: ./dev-build.sh ${AWS_CLI_VERSION} ${TERRAFORM_VERSION}"
echo "Building images with default parameters"
docker image build -f Dockerfile -t zenika/terraform-azure-cli:dev .
fi

0 comments on commit 1f89e5a

Please sign in to comment.