Skip to content

Docker Workflow (WIP) - #1

Closed
xashr wants to merge 30 commits into
mainfrom
feat/docker_workflow
Closed

Docker Workflow (WIP)#1
xashr wants to merge 30 commits into
mainfrom
feat/docker_workflow

Conversation

@xashr

@xashr xashr commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

PR 30 added Dockerfiles for CPU and CUDA including examples. This PR adds a full GitHub workflow for building, caching and publishing multi-architecture Docker images to GHCR. Inspired by llama.cpp, adapted to audio.cpp.

This allows the user to simply reference a public docker image without having to build it locally (which is still supported).

Example (if merged): docker pull ghcr.io/0xShug0/audio.cpp:full-cpu

See the fork workflow and fork image tags in action.

Workflow

Trigger

Workflow gets triggered daily at 3:21 UTC or manually. The workflow checks for new commits. If there is no new commit since the last build, the workflow jobs get cancelled to avoid wasting resources.

Can be adjusted as needed, e.g. build weekly to reduce actions usage.

Stages

  1. check-commits — Compares HEAD to last-docker-build tag. Skips the entire run if no new commits since the last daily build. workflow_dispatch with force_build=true overrides the skip.

  2. metadata — Computes build_date and date_tag once so all jobs use the same timestamp.

  3. build — Runs in parallel across architectures (amd64, arm64) and variants (cpu, cuda12, cuda13). Each job:

    • Builds a single-arch image targeting the full stage
    • Pushes by digest to ghcr.io
    • Uploads the digest as an artifact for the merge stage
  4. merge — Downloads per-arch digests and uses docker buildx imagetools create to assemble multi-arch manifests with OCI annotations. Produces:

    • full-cpu — mutable "latest" tag
    • full-cpu-YYYYMMDD-HHHHHHH — immutable pinned tag
    • full-cuda12 — mutable "latest" tag
    • full-cuda12-YYYYMMDD-HHHHHHH — immutable pinned tag
    • full-cuda13 — mutable "latest" tag
    • full-cuda13-YYYYMMDD-HHHHHHH — immutable pinned tag
  5. update-tag — Force-pushes the last-docker-build git tag to HEAD, enabling the skip-detection in step 1.

Tested variants

Tested:
amd64: cpu, cuda12, cuda13 on Intel CPU + RTX 5090
arm64: cpu on Macbook Pro M5

Not tested (lacking hardware):
arm64: cuda12, cuda13

What is not included in this PR

This PR provides the workflow. If the PR gets accepted and the workflow works reliably, I can extend the documentation and examples.

Open issues

  • ENGINE_ENABLE_NATIVE_CPU=OFF . For local Docker builds this can be set to ON for improved performance. For published Docker builds it needs to be OFF to ensure portability, resulting in worse performance. llama.cpp offers the option to build with GGML_CPU_ALL_VARIANTS=ON which builds multiple separate CPU backend shared libraries, each optimized for a different CPU generation and loaded dynamically. It would be great to have that option for audio.cpp as well.

xashr added 30 commits July 11, 2026 19:09
Builds and publishes multi-arch images to ghcr.io:
  full-cpu          (latest, mutable)
  full-cpu-<sha>    (pinned to commit)
  full-cuda12       (latest, mutable)
  full-cuda12-<sha> (pinned to commit)

CPU builds are enabled; CUDA 12 builds are present but skipped
by default for initial testing.
- Pass IMAGE_URL and IMAGE_SOURCE via build-args instead of
  hardcoding them in Dockerfiles, so the labels always reflect
  the actual repository (works correctly for forks).

- Add OCI index annotations (created, revision, url, source) to
  merged multi-arch manifests via imagetools create.

- Make merge job strict: fail if 1/2 arch digests are missing
  (partial build failure), exit cleanly if 0/2 (intentionally
  skipped).
- Update default CUDA version from 12.9.0 to 12.9.2
- Add cuda13 tag (CUDA 13.3.0) for both amd64 and arm64
- Extend merge matrix to produce full-cuda13 / full-cuda13-<sha> images
- Rename workflow from 'Publish Docker image' to 'Build and publish Docker images'
- Move schedule trigger before workflow_dispatch (schedule first, dispatch optional)
- Remove stale 'remove after testing' comment
Replace short SHA (e.g. a1b2c3d4) with date (e.g. 20260711) for
immutable Docker image tags. Immutable tags are now human-readable
and sortable, e.g. full-cuda12-20260711 instead of full-cuda12-a1b2c3d4.
Disable ENGINE_ENABLE_NATIVE_CPU in Docker builds so the compiled
binaries do not use -march=native. This prevents SIGILL crashes when
running arm64 images on a different ARM CPU than the build runner
(e.g. Ampere Altra CI runner vs Apple M-series).

Matches the approach used by llama.cpp's Docker images.
- Enable CPU image builds for amd64 and arm64 (skip: false)
- Disable CUDA 12 and CUDA 13 builds (skip: true)

This allows the CPU images to be published with the GGML_NATIVE fix,
while CUDA builds are temporarily disabled for testing.
- Add 7-char commit SHA to immutable tags (full-cpu-YYYYMMDD-HHHHHHH)
- Add check-commits job to skip daily builds when no new commits
- Manual trigger (workflow_dispatch) always builds, bypassing the check
- Rename matrix skip flag to enabled for clarity
- Track last built commit via lightweight git tag last-docker-build
- Add workflow_dispatch input 'force_build' (default: true)
- When force_build=false, manual trigger respects commit check (skip if no new commits)
- Revert schedule from hourly back to daily (4:12 AM UTC)
- actions/checkout: v4 -> v5 (Node 24 runtime)
- docker/build-push-action: v6 -> v7 (Node 24 runtime, ESM)
- actions/upload-artifact: v4 -> v7 (Node 24 runtime, ESM)
- actions/download-artifact: v4 -> v8 (Node 24 runtime, ESM)

No input parameter changes needed; all changes are version label bumps
on the floating major-version tags.
Rename workflow jobs to use consistent verb-first naming:
- Check commits -> Check for new commits
- Metadata -> Generate metadata
- Build variants -> Build (tag, platform)
- Merge variants -> Merge (tag)
- Update last-docker-build tag -> Update build tag
- Replace 3-line === separator style with single-line ── header style
- Match comment style from docker.yml workflow
- Pad all section headers to exactly 80 characters
@xashr xashr closed this Jul 18, 2026
@xashr
xashr deleted the feat/docker_workflow branch July 18, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant