Skip to content
Latchkey

Docker build workflow (allangood/rtlamr2mqtt)

The Docker build workflow from allangood/rtlamr2mqtt, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, SHA-pinned actions, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: allangood/rtlamr2mqtt.github/workflows/main.ymlLicense MITView source

What it does

This is the Docker build workflow from the allangood/rtlamr2mqtt repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: "Docker build"

on:
  workflow_dispatch:
    inputs:
      tags:
        description: "Manual trigger"
  push:
    paths-ignore:
      - "**.md"
      - "**.json"
      - "**.yaml"
      - "LICENSE"
      - "examples/**"
    branches:
      - main
      - dev
      - async
    tags:
      - "*.*.*"
  pull_request:
    paths-ignore:
      - "**.md"
      - "**.json"
      - "**.yaml"
      - "LICENSE"
      - "examples/**"
    branches:
      - main
      - dev
      - async

concurrency:
  group: "build-${{ github.ref }}"
  cancel-in-progress: true

env:
  IMAGE_NAME: rtlamr2mqtt

jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: "3.13"
      - name: Install dependencies
        working-directory: rtlamr2mqtt-addon
        run: pip install -r requirements-dev.txt
      - name: Run tests
        working-directory: rtlamr2mqtt-addon
        run: pytest -v

  release:
    needs: tests
    if: github.event_name != 'pull_request'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v6
        with:
          # list of Docker images to use as base name for tags
          images: |
            ${{ github.actor }}/rtlamr2mqtt
          # generate Docker tags based on the following events/attributes
          tags: |
            type=ref,event=branch
            type=semver,pattern={{version}}
            type=sha
      - name: Set up QEMU
        id: qemu
        uses: docker/setup-qemu-action@v4
        with:
          platforms: "amd64,arm64,arm/v7,arm/v6"
      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v4
      - name: Available platforms
        run: echo ${{ steps.buildx.outputs.platforms }}
      - name: Login to DockerHub
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v4
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      - name: Build and push
        uses: docker/build-push-action@v7
        with:
          context: rtlamr2mqtt-addon/
          platforms: linux/amd64,linux/arm64
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

name: "Docker build"
 
on:
  workflow_dispatch:
    inputs:
      tags:
        description: "Manual trigger"
  push:
    paths-ignore:
      - "**.md"
      - "**.json"
      - "**.yaml"
      - "LICENSE"
      - "examples/**"
    branches:
      - main
      - dev
      - async
    tags:
      - "*.*.*"
  pull_request:
    paths-ignore:
      - "**.md"
      - "**.json"
      - "**.yaml"
      - "LICENSE"
      - "examples/**"
    branches:
      - main
      - dev
      - async
 
concurrency:
  group: "build-${{ github.ref }}"
  cancel-in-progress: true
 
env:
  IMAGE_NAME: rtlamr2mqtt
 
jobs:
  tests:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          cache: 'pip'
          python-version: "3.13"
      - name: Install dependencies
        working-directory: rtlamr2mqtt-addon
        run: pip install -r requirements-dev.txt
      - name: Run tests
        working-directory: rtlamr2mqtt-addon
        run: pytest -v
 
  release:
    timeout-minutes: 30
    needs: tests
    if: github.event_name != 'pull_request'
    runs-on: latchkey-small
    steps:
      - name: Checkout
        uses: actions/checkout@v6
      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v6
        with:
          # list of Docker images to use as base name for tags
          images: |
            ${{ github.actor }}/rtlamr2mqtt
          # generate Docker tags based on the following events/attributes
          tags: |
            type=ref,event=branch
            type=semver,pattern={{version}}
            type=sha
      - name: Set up QEMU
        id: qemu
        uses: docker/setup-qemu-action@v4
        with:
          platforms: "amd64,arm64,arm/v7,arm/v6"
      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v4
      - name: Available platforms
        run: echo ${{ steps.buildx.outputs.platforms }}
      - name: Login to DockerHub
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v4
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
      - name: Build and push
        uses: docker/build-push-action@v7
        with:
          context: rtlamr2mqtt-addon/
          platforms: linux/amd64,linux/arm64
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
 

What changed

5 third-party actions are referenced by a movable tag. Pin them 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:

This workflow runs 2 jobs per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow