Skip to content

Commit

Permalink
add commit hash based docker image tags (#194)
Browse files Browse the repository at this point in the history
* add git commit SHA as tag to docker image

* switch to 5 character tags from 7
  • Loading branch information
KingPin authored Feb 1, 2024
1 parent f3341b1 commit 22e309f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
build-and-push:
runs-on: ubuntu-latest
env:
GIT_SHA: ${GITHUB_SHA::5}
permissions:
contents: write
packages: write
Expand Down Expand Up @@ -43,6 +45,10 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Get short SHA for github commits
id: slug
run: echo "GIT_SHA5=$(echo ${GITHUB_SHA} | cut -c1-5)" >> "$GITHUB_OUTPUT"

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
Expand All @@ -54,4 +60,6 @@ jobs:
cache-to: type=gha,mode=max
tags: |
ghcr.io/${{ env.GITHUB_OWNER_LC }}/${{ github.event.repository.name }}:latest
ghcr.io/${{ env.GITHUB_OWNER_LC }}/${{ github.event.repository.name }}:${{ steps.slug.outputs.GIT_SHA5 }}
docker.io/spoked/iceberg:latest
docker.io/spoked/iceberg:${{ steps.slug.outputs.GIT_SHA5 }}

0 comments on commit 22e309f

Please sign in to comment.