Docker Build workflow (GACWR/OpenUBA)
The Docker Build workflow from GACWR/OpenUBA, explained and optimized by Latchkey.
CI health: C - fair
Point runs-on at Latchkey and get run de-duplication, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.
What it does
This is the Docker Build workflow from the GACWR/OpenUBA repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Docker Build
on:
push:
branches: [master, dev/**]
paths:
- "docker/**"
- "core/**"
- "interface/**"
- "requirements.txt"
- "Makefile"
pull_request:
branches: [master]
jobs:
build-backend:
name: Build backend image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build backend Docker image
run: docker build -f docker/backend.dockerfile -t openuba-backend:ci .
build-frontend:
name: Build frontend image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build frontend Docker image
run: docker build -f docker/frontend.dockerfile -t openuba-frontend:ci .
build-operator:
name: Build operator image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build operator Docker image
run: docker build -f docker/operator.dockerfile -t openuba-operator:ci .
build-model-runners:
name: Build model runner images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build base model runner
run: docker build -f docker/model-runner/Dockerfile.base -t openuba-model-runner:base .
- name: Build sklearn runner
run: docker build -f docker/model-runner/Dockerfile.sklearn -t openuba-model-runner:sklearn --build-arg BASE_IMAGE=openuba-model-runner:base .
- name: Build PyTorch runner
run: docker build -f docker/model-runner/Dockerfile.pytorch -t openuba-model-runner:pytorch --build-arg BASE_IMAGE=openuba-model-runner:base .
- name: Build TensorFlow runner
run: docker build -f docker/model-runner/Dockerfile.tensorflow -t openuba-model-runner:tensorflow --build-arg BASE_IMAGE=openuba-model-runner:base .
- name: Build NetworkX runner
run: docker build -f docker/model-runner/Dockerfile.networkx -t openuba-model-runner:networkx --build-arg BASE_IMAGE=openuba-model-runner:base .
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Docker Build on: push: branches: [master, dev/**] paths: - "docker/**" - "core/**" - "interface/**" - "requirements.txt" - "Makefile" pull_request: branches: [master] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build-backend: timeout-minutes: 30 name: Build backend image runs-on: latchkey-small steps: - uses: actions/checkout@v4 - name: Build backend Docker image run: docker build -f docker/backend.dockerfile -t openuba-backend:ci . build-frontend: timeout-minutes: 30 name: Build frontend image runs-on: latchkey-small steps: - uses: actions/checkout@v4 - name: Build frontend Docker image run: docker build -f docker/frontend.dockerfile -t openuba-frontend:ci . build-operator: timeout-minutes: 30 name: Build operator image runs-on: latchkey-small steps: - uses: actions/checkout@v4 - name: Build operator Docker image run: docker build -f docker/operator.dockerfile -t openuba-operator:ci . build-model-runners: timeout-minutes: 30 name: Build model runner images runs-on: latchkey-small steps: - uses: actions/checkout@v4 - name: Build base model runner run: docker build -f docker/model-runner/Dockerfile.base -t openuba-model-runner:base . - name: Build sklearn runner run: docker build -f docker/model-runner/Dockerfile.sklearn -t openuba-model-runner:sklearn --build-arg BASE_IMAGE=openuba-model-runner:base . - name: Build PyTorch runner run: docker build -f docker/model-runner/Dockerfile.pytorch -t openuba-model-runner:pytorch --build-arg BASE_IMAGE=openuba-model-runner:base . - name: Build TensorFlow runner run: docker build -f docker/model-runner/Dockerfile.tensorflow -t openuba-model-runner:tensorflow --build-arg BASE_IMAGE=openuba-model-runner:base . - name: Build NetworkX runner run: docker build -f docker/model-runner/Dockerfile.networkx -t openuba-model-runner:networkx --build-arg BASE_IMAGE=openuba-model-runner:base .
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.
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 4 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.