Skip to content

Fix docker invocation in hooks #10

Fix docker invocation in hooks

Fix docker invocation in hooks #10

Workflow file for this run

name: Build Docker image
on:
pull_request:
types: ['opened', 'edited']
workflow_dispatch:
jobs:
build_image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Define versions, date and tag
run: |
alpine_version=$(grep -i alpine .versions | cut -d '=' -f2)
echo "alpine_version=$alpine_version" >> $GITHUB_ENV
packer_version=$(grep -i packer .versions | cut -d '=' -f2)
echo "packer_version=$packer_version" >> $GITHUB_ENV
terraform_version=$(grep -i terraform .versions | cut -d '=' -f2)
echo "terraform_version=$terraform_version" >> $GITHUB_ENV
terragrunt_version=$(grep -i terragrunt .versions | cut -d '=' -f2)
echo "terragrunt_version=$terragrunt_version" >> $GITHUB_ENV
image_create_date=$(date '+%Y-%m-%dT%H:%M:%S')
echo "image_create_date=$image_create_date" >> $GITHUB_ENV
echo "image_version=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: exdial/infra-tools
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: |
exdial/infra-tools:latest
exdial/infra-tools:${{ env.image_version }}
build-args: |
ALPINE_VERSION=${{ env.alpine_version }}
PACKER_VERSION=${{ env.packer_version }}
TERRAFORM_VERSION=${{ env.terraform_version }}
TERRAGRUNT_VERSION=${{ env.terragrunt_version }}
IMAGE_CREATE_DATE=${{ env.image_create_date }}
IMAGE_VERSION=${{ env.image_version }}