Docker CI workflow (ryanlelek/Raneto)
The Docker CI workflow from ryanlelek/Raneto, 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 CI workflow from the ryanlelek/Raneto 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
---
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
name: Docker CI
on:
push:
branches: ['main']
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
environment: Docker
steps:
# https://github.com/marketplace/actions/checkout
# - name: Build the Docker image
# uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# run: docker build . --file Dockerfile --tag raneto/raneto:latest-$(date +%s)
# https://github.com/marketplace/actions/docker-setup-qemu
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
# https://github.com/marketplace/actions/docker-setup-buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
# https://github.com/marketplace/actions/docker-login
# https://github.com/docker/login-action
- name: Login to Docker Hub
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
# https://github.com/marketplace/actions/build-and-push-docker-images
# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images
- name: Build and push
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
#context: .
platforms: linux/amd64,linux/arm64
push: true
tags: raneto/raneto:unstable
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
--- # https://docs.github.com/en/actions/publishing-packages/publishing-docker-images name: Docker CI on: push: branches: ['main'] permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: timeout-minutes: 30 runs-on: latchkey-small environment: Docker steps: # https://github.com/marketplace/actions/checkout # - name: Build the Docker image # uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # run: docker build . --file Dockerfile --tag raneto/raneto:latest-$(date +%s) # https://github.com/marketplace/actions/docker-setup-qemu - name: Set up QEMU uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 # https://github.com/marketplace/actions/docker-setup-buildx - name: Set up Docker Buildx uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 # https://github.com/marketplace/actions/docker-login # https://github.com/docker/login-action - name: Login to Docker Hub uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_TOKEN }} # https://github.com/marketplace/actions/build-and-push-docker-images # https://docs.github.com/en/actions/publishing-packages/publishing-docker-images - name: Build and push uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0 with: #context: . platforms: linux/amd64,linux/arm64 push: true tags: raneto/raneto:unstable
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 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.