build&publishtoDockerHub workflow (graphistry/graph-app-kit)
The build&publishtoDockerHub workflow from graphistry/graph-app-kit, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the build&publishtoDockerHub workflow from the graphistry/graph-app-kit repository, a real project running GitHub Actions. It is shown here with attribution under its BSD-3-Clause license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: build&publishtoDockerHub
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+(.*)'
workflow_dispatch:
inputs:
version:
description: 'Version to bump to'
required: false
cuda_versions:
description: 'JSON array of CUDA versions'
required: false
default: '["12.8", "11.8"]'
workflow_call:
jobs:
docker-build-publish:
runs-on: ubuntu-latest-4-cores
strategy:
matrix:
CUDA_SHORT_VERSION: ${{ fromJSON(inputs.cuda_versions || '["12.8", "11.8"]') }}
fail-fast: true
steps:
- name: checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: get most recent tag
run: |
echo "RELEASE_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "CUDA_SHORT_VERSION=${{ matrix.CUDA_SHORT_VERSION }}" >> $GITHUB_ENV
- name: check env
run: |
echo $RELEASE_VERSION
echo ${{ env.RELEASE_VERSION }}
echo $CUDA_SHORT_VERSION
echo ${{ env.CUDA_SHORT_VERSION }}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Graph-App-Kit
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
run: |
cd src/docker \
&& GRAPHISTRY_FORGE_BASE_VERSION=v${{ env.RELEASE_VERSION }}-${{ env.CUDA_SHORT_VERSION }} docker compose -f docker-compose.yml build
- name: tag the image
run: |
docker tag graphistry/graph-app-kit-st:latest-${{ env.CUDA_SHORT_VERSION }} graphistry/graph-app-kit-st:v${{ env.RELEASE_VERSION }}-${{ env.CUDA_SHORT_VERSION }}
- name: Publish Graph-App-Kit to DockerHub
run: |
docker push graphistry/graph-app-kit-st:v${{ env.RELEASE_VERSION }}-${{ env.CUDA_SHORT_VERSION }} && docker push graphistry/graph-app-kit-st:latest-${{ env.CUDA_SHORT_VERSION }}
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: build&publishtoDockerHub on: push: tags: - '[0-9]+.[0-9]+.[0-9]+(.*)' workflow_dispatch: inputs: version: description: 'Version to bump to' required: false cuda_versions: description: 'JSON array of CUDA versions' required: false default: '["12.8", "11.8"]' workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: docker-build-publish: timeout-minutes: 30 runs-on: latchkey-small-4-cores strategy: matrix: CUDA_SHORT_VERSION: ${{ fromJSON(inputs.cuda_versions || '["12.8", "11.8"]') }} fail-fast: true steps: - name: checkout repo uses: actions/checkout@v3 with: fetch-depth: 0 - name: get most recent tag run: | echo "RELEASE_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV echo "CUDA_SHORT_VERSION=${{ matrix.CUDA_SHORT_VERSION }}" >> $GITHUB_ENV - name: check env run: | echo $RELEASE_VERSION echo ${{ env.RELEASE_VERSION }} echo $CUDA_SHORT_VERSION echo ${{ env.CUDA_SHORT_VERSION }} - name: Login to DockerHub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build Graph-App-Kit env: DOCKER_BUILDKIT: 1 COMPOSE_DOCKER_CLI_BUILD: 1 run: | cd src/docker \ && GRAPHISTRY_FORGE_BASE_VERSION=v${{ env.RELEASE_VERSION }}-${{ env.CUDA_SHORT_VERSION }} docker compose -f docker-compose.yml build - name: tag the image run: | docker tag graphistry/graph-app-kit-st:latest-${{ env.CUDA_SHORT_VERSION }} graphistry/graph-app-kit-st:v${{ env.RELEASE_VERSION }}-${{ env.CUDA_SHORT_VERSION }} - name: Publish Graph-App-Kit to DockerHub run: | docker push graphistry/graph-app-kit-st:v${{ env.RELEASE_VERSION }}-${{ env.CUDA_SHORT_VERSION }} && docker push graphistry/graph-app-kit-st:latest-${{ env.CUDA_SHORT_VERSION }}
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. This example useslatchkey-small; pick the runner size that fits the job. - Cancel superseded runs when a branch or PR gets a newer push.
- Add a job timeout so a hung step cannot burn hours of runner time.
1 third-party action is referenced by a movable tag. Pin it to the commit SHA (Latchkey resolves and applies this automatically) so a repointed tag cannot change what runs.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Container pulls and builds
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.