Skip to content
Latchkey

Container workflow (fal-ai/fal)

The Container workflow from fal-ai/fal, explained and optimized by Latchkey.

C

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.

Grade your own workflow free or run it on Latchkey →
Source: fal-ai/fal.github/workflows/container.ymlLicense Apache-2.0View source

What it does

This is the Container workflow from the fal-ai/fal 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

workflow (.yml)
name: Container

on:
  push:
    branches: [ main ]
    tags:
      - "*"
  pull_request:
    branches: [ main ]
  workflow_dispatch:
  workflow_call:
    inputs:
      version:
        description: Version
        required: false
        type: string

jobs:

  container:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
    - name: Set up QEMU
      uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
    - name: Build container
      uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4.2.1
      with:
        context: .

  push:
    if: github.event_name != 'pull_request'
    needs:
    - container
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
    - name: Set up QEMU
      uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
    - name: Login to GitHub Container Registry
      uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
      with:
        registry: ghcr.io
        username: ${{ github.repository_owner }}
        password: ${{ secrets.GITHUB_TOKEN }}
    - name: Determine Version
      id: version
      run: echo "::set-output name=version::$(git describe --always --tags --dirty)"
    - name: Build and push
      id: push
      uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4.2.1
      with:
        context: .
        push: true
        platforms: linux/amd64, linux/arm64
        tags: ghcr.io/fal-ai/fal:latest, ghcr.io/fal-ai/fal:${{ inputs.version || steps.version.outputs.version }}
    - name: Determine digest
      run: echo ${{ steps.push.outputs.digest }}

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Container
 
on:
  push:
    branches: [ main ]
    tags:
      - "*"
  pull_request:
    branches: [ main ]
  workflow_dispatch:
  workflow_call:
    inputs:
      version:
        description: Version
        required: false
        type: string
 
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true
 
jobs:
 
  container:
    timeout-minutes: 30
    runs-on: latchkey-small
    steps:
    - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
    - name: Set up QEMU
      uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
    - name: Build container
      uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4.2.1
      with:
        context: .
 
  push:
    timeout-minutes: 30
    if: github.event_name != 'pull_request'
    needs:
    - container
    runs-on: latchkey-small
    steps:
    - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
    - name: Set up QEMU
      uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@885d1462b80bc1c1c7f0b00334ad271f09369c55 # v2.10.0
    - name: Login to GitHub Container Registry
      uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
      with:
        registry: ghcr.io
        username: ${{ github.repository_owner }}
        password: ${{ secrets.GITHUB_TOKEN }}
    - name: Determine Version
      id: version
      run: echo "::set-output name=version::$(git describe --always --tags --dirty)"
    - name: Build and push
      id: push
      uses: docker/build-push-action@0a97817b6ade9f46837855d676c4cca3a2471fc9 # v4.2.1
      with:
        context: .
        push: true
        platforms: linux/amd64, linux/arm64
        tags: ghcr.io/fal-ai/fal:latest, ghcr.io/fal-ai/fal:${{ inputs.version || steps.version.outputs.version }}
    - name: Determine digest
      run: echo ${{ steps.push.outputs.digest }}
 

What changed

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