Skip to content

feat(dev): add devcontainers#9187

Draft
keturn wants to merge 4 commits into
invoke-ai:mainfrom
keturn:devcontainer26
Draft

feat(dev): add devcontainers#9187
keturn wants to merge 4 commits into
invoke-ai:mainfrom
keturn:devcontainer26

Conversation

@keturn
Copy link
Copy Markdown
Contributor

@keturn keturn commented May 16, 2026

Summary

Development Containers can be a good way to get a development environment running. Containers also provide some isolation to the host system from supply chain attacks (though this is not absolute; your IDE will still require you to assert you trust this repository before it will run this configuration).

Dev containers may be run locally by your IDE (VS Code, PyCharm Pro), on a cloud IDE (GitHub Codespaces), or by an editor-agnostic host (DevPod).

Implementation Details

Unfortunately there is no extension mechanism for devcontainer.json, so we've cobbled one together.

base/partial.jsonc contains the common base of the devcontainer configuration.

merge-partial-configs.sh merges it with other partial.jsonc files to form full devcontainer.json configs in subdirectories.

Differences from /docker/Dockerfile

Production containers are typically optimized for deployment size and strip away anything non-essential for running their single service.

Development containers are built for developer experience. They include all the tools to build, test, and debug the application.

Production containers include the application code in their image.

Development containers assume you're going to be changing the code,
so the image provides the environment but the application code is mounted separately at runtime.

Related Issues / Discussions

It's been a year since the last time we tried this in #7944. Since then, Invoke's pyproject.toml has gotten better-behaved about compatibility with uv sync in how it manages the torch dependencies.

I did this one pretty much from scratch and ended up with some different results for where package caches live than @dsisco11's version. I'm not attached to those differences, and we could certainly bring those configurations forward to here if it seems like a good idea on review.

QA Instructions

Open the project in VS Code and run its Reopen in Container command.

  • CPU-only container
  • CUDA container

For each, the install step for all packages should automatically happen when the container is started, leaving development commands ready to run.

  • in docs/, run pnpm run build
  • in invokeai/frontend/web/, run pnpm run build
  • run invokeai-web and make sure it has appropriate GPU access, and that your browser can load it.

If you're feeling ambitious, do all of the above in PyCharm/WebStorm Pro, DevPod, and your other favorite IDE.

Merge Plan

This PR is currently self-contained to the .devcontainer directory and thus has minimal merge considerations.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • N/A Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

@keturn
Copy link
Copy Markdown
Contributor Author

keturn commented May 16, 2026

This is a viable proof of concept. Floating it here as a draft to see if it seems more palatable than last year's attempt.

If there's appetite for it, I can update the contributor/developer docs to incorporate it. And hopefully we find people to work out how things go on a wider range of hosts (Windows, Mac, ROCm, etc).

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