Skip to content

feat(docker): add Dockerfile.arm64 for Linux aarch64 / SBC builds#9095

Open
Steve235lab wants to merge 1 commit intoinvoke-ai:mainfrom
Steve235lab:feat/docker-arm64
Open

feat(docker): add Dockerfile.arm64 for Linux aarch64 / SBC builds#9095
Steve235lab wants to merge 1 commit intoinvoke-ai:mainfrom
Steve235lab:feat/docker-arm64

Conversation

@Steve235lab
Copy link
Copy Markdown

Summary

  • Adds docker/Dockerfile.arm64 to support building InvokeAI on Linux ARM64 devices (Raspberry Pi, SBCs, etc.)
  • Updates docker/README.md with build instructions and corrects the "only x86_64 is supported" note

Why it's needed: The existing Dockerfile fails on linux/aarch64 because PyTorch's +cpu wheels on download.pytorch.org/whl/cpu are only published for manylinux_2_28_x86_64 and win_amd64. There are no aarch64 wheels on that index.

How it works:

The new Dockerfile.arm64 diverges from the upstream Dockerfile in one key section — the dependency install step:

  1. pyproject.toml is COPYed as a writable file rather than a read-only bind-mount.
  2. awk strips the explicit [tool.uv.sources] index overrides for torch, torchvision, and pytorch-triton-rocm, so uv falls back to PyPI for those packages.
  3. sed replaces all platform-specific version pins (+cpu / +cu128 / +rocm*) across all optional extras with bare PyPI-compatible specifiers. This is necessary because uv sync resolves all extras simultaneously — any unresolvable extra (e.g. rocm still pinning torch==2.7.1+rocm6.3) fails the entire build even if that extra isn't being installed.
  4. uv sync --extra cpu is run without --frozen since the lock file was generated on x86_64.

PyPI ships torch==2.7.1 and torchvision==0.22.1 with linux_aarch64 wheels, so the install succeeds cleanly.

Tested on: Raspberry Pi 5, linux/aarch64, Ubuntu 24.04, Docker 27.x. Full build succeeds and InvokeAI starts correctly.

Scope note: This PR covers Linux ARM64 only. macOS Apple Silicon has different Docker/PyTorch considerations and is out of scope here.

Related Issues / Discussions

The upstream Dockerfile already contains this comment acknowledging the gap:

# NOTE: there are no pytorch builds for arm64 + cuda, only cpu

QA Instructions

On any linux/aarch64 machine with Docker installed:

git clone https://github.com/invoke-ai/InvokeAI.git
cd InvokeAI
docker build -f docker/Dockerfile.arm64 -t invokeai:arm64 .
docker run --publish 9090:9090 --volume ~/invokeai:/invokeai invokeai:arm64

Navigate to http://localhost:9090 and verify the UI loads. API-backed models (GPT Image, Gemini) can be configured and used without a GPU.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • Documentation added / updated (if applicable)

PyTorch does not publish +cpu wheels for linux/aarch64 on the
pytorch.org WHL index, so the existing Dockerfile fails on Raspberry Pi
and other ARM SBCs with:

  Distribution `torchvision==0.22.1+cpu` can't be installed because it
  doesn't have a source distribution or wheel for the current platform
  hint: manylinux_2_28_x86_64 / win_amd64 only

Dockerfile.arm64 works around this by:
1. COPYing pyproject.toml as a writable file instead of a read-only
   bind-mount.
2. Using awk/sed to strip the explicit per-extra pytorch-index source
   overrides ([tool.uv.sources] for torch, torchvision,
   pytorch-triton-rocm) so uv falls back to PyPI for all three packages.
3. Replacing all platform-specific version pins (+cpu / +cu128 / +rocm*)
   in every optional extra with bare PyPI-compatible specifiers, because
   uv resolves all extras simultaneously and any unresolvable extra
   fails the whole build.
4. Running `uv sync --extra cpu` without --frozen (lock file was
   generated on x86_64 and cannot be used verbatim on aarch64).

Tested on Raspberry Pi 5 (linux/aarch64, Ubuntu 24.04).
Installs torch==2.7.1 and torchvision==0.22.1 from PyPI aarch64 wheels.

Also updates docker/README.md to document the ARM64 build path and
corrects the "only x86_64 is supported" note.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant