Skip to content

build: add stable-diffusion server to musa and vulkan container images#504

Merged
mostlygeek merged 5 commits intomainfrom
build/dry-sd-containerfile
Feb 2, 2026
Merged

build: add stable-diffusion server to musa and vulkan container images#504
mostlygeek merged 5 commits intomainfrom
build/dry-sd-containerfile

Conversation

@mostlygeek
Copy link
Copy Markdown
Owner

@mostlygeek mostlygeek commented Feb 1, 2026

Summary

  • Adds sd-server from stable-diffusion.cpp container images to musa and vulkan variants
  • llama-swap-sd.Containerfile is a thin 10-line layer on top of the base image (instead of duplicating the full 49-line Containerfile)
  • Build script builds the base image first, then layers sd-server on top for supported architectures
  • Includes build script hardening (set -euo pipefail, env var defaults, ${GITHUB_TOKEN:-} fix)
  • Adds sd-server example to config.example.yaml

Supersedes #450 with a DRY approach.

Summary by CodeRabbit

  • New Features

    • Added Stable Diffusion server integration for supported architectures.
    • Included a new example model configuration for Stable Diffusion usage.
  • Chores

    • Improved build reliability with stricter error handling and safer defaults.
    • Added conditional build steps to produce an additional SD image layer for supported platforms.

✏️ Tip: You can customize this high-level summary in your review settings.

Layer sd-server from stable-diffusion.cpp container images onto the
base llama-swap image for supported architectures (musa, vulkan).

- add llama-swap-sd.Containerfile as a thin layer on top of the base image
- update build-container.sh to build base first, then layer SD on top
- add sd-server example config to config.example.yaml
- add set -euo pipefail and env var defaults to build script

closes #450
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 1, 2026

Warning

Rate limit exceeded

@mostlygeek has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

Adds Stable Diffusion server layering to the container build flow: strict bash error handling and debug flags in the build script, new SD_IMAGE/SD_TAG build args, a conditional post-build step that builds an sd-server layer for musa and vulkan architectures, a new Containerfile to copy the sd-server binary into the final image, and an example config entry for a "z-image" model.

Changes

Cohort / File(s) Summary
Build script
docker/build-container.sh
Adds set -euo pipefail, LOG_DEBUG/DEBUG_ABORT_BUILD and log_debug, defensive GITHUB_TOKEN handling, new SD_IMAGE/SD_TAG variables, and an architecture conditional that builds/pushes an additional sd-server image layer for musa/vulkan using llama-swap-sd.Containerfile.
Containerfile
docker/llama-swap-sd.Containerfile
New multi-stage Containerfile that accepts SD_IMAGE/SD_TAG, pulls the SD image as a source stage, and copies /sd-server into the final llama-swap image with configurable UID/GID.
Example config
docker/config.example.yaml
Adds a new models.z-image entry including checkEndpoint/cmd for /app/sd-server and an aliases list (formatting and new model declaration).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'build: add stable-diffusion server to musa and vulkan container images' directly and specifically describes the main change: adding stable-diffusion server support to container images for two specific architectures. It is clear, concise, and accurately summarizes the primary objective of the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch build/dry-sd-containerfile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@docker/build-container.sh`:
- Line 114: The SD_TAG variable is set to an architecture-specific tag (SD_TAG)
that doesn't exist for musa/vulkan and causes the COPY --from stage to fail;
update the SD_TAG assignment (the SD_TAG variable used by the COPY --from step)
to use an upstream-compatible tag format (e.g.,
master-<build-number>-<git-short-sha>) or implement a lookup to fetch a valid
master-* tag from ghcr.io/leejet/stable-diffusion.cpp before the COPY --from
step, or alternatively ensure you build/publish architecture-specific images
yourself so the COPY --from stage can pull them; adjust any places referencing
SD_TAG accordingly.

In `@docker/config.example.yaml`:
- Around line 20-33: The z-image model entry is missing the proxy field and uses
a literal block for cmd which preserves newlines; add a proxy:
"http://127.0.0.1:9999" key to the z-image mapping and convert the cmd from a
literal block (|) to a folded block (>) so the command becomes a single-line
string (ensure all flags and paths for /app/sd-server, --listen-port,
--diffusion-model, --vae, --llm, --offload-to-cpu, --cfg-scale,
--height/--width, --steps remain space-separated) so llama-swap can route to the
spawned server and parse the command correctly.

@mostlygeek mostlygeek merged commit bc01e6f into main Feb 2, 2026
8 checks passed
@mostlygeek mostlygeek deleted the build/dry-sd-containerfile branch February 2, 2026 00:17
@rare-magma
Copy link
Copy Markdown
Contributor

@mostlygeek perhaps it would be worth adding some info to the readme to improve discoverability of this feature?

@mostlygeek
Copy link
Copy Markdown
Owner Author

@rare-magma oh yes, that's a good idea. Would you mind opening a PR with the config changes you introduced? Those were good.

rohitpaul pushed a commit to rohitpaul/llama-swap that referenced this pull request Mar 29, 2026
mostlygeek#504)

Add sd-server from stable-diffusion.cpp docker image for 
vulkan and musa containers.

closes mostlygeek#450
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.

2 participants