fix(docker): optimize image size — .dockerignore, drop dev deps, split build layers - #38749
Conversation
…plit build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately.
austinpickett
left a comment
There was a problem hiding this comment.
Hermes Agent Review — 🔴 Request Changes (the new [docker] extra is a no-op duplicate of [all]; the rest is good)
Two of the three changes are genuinely useful. The new dependency extra, however, rests on a false premise.
✅ Keep
.dockerignoreadditions — excludingapps/,tests/,website/,docs/,nix/,packaging/,acp_registry/, etc. meaningfully shrinks the build context. Correct (none of those are read by the container runtime).- Frontend-build layer reordering — copying
web/+ui-tui/and building them beforeCOPY . .so Python-only source changes don't invalidate the slow web/ui-tui build layer is a real caching win. Good.
🔴 Blocking — the [docker] extra duplicates [all] verbatim
The PR's rationale is that [docker] is "[all] minus [dev]". But [all] on current origin/main does not contain [dev] — there was a deliberate 2026-05-12 policy change (documented in the [all] comment) that already restricts [all] to non-lazy-installable extras only. [all] today is exactly:
cron, cli, pty, mcp, homeassistant, sms, acp, google, web, youtube
…and your new [docker] extra is that same list, member-for-member. So uv sync --extra docker resolves to identical deps as --extra all — the Dockerfile swap changes nothing dependency-wise. What it does add is a second extra that must be kept in lockstep with [all] forever: the moment [all] gains a member, [docker] silently won't, and the image quietly loses a production dep. That's a maintenance/drift hazard for zero benefit.
Ask: drop the [docker] extra from pyproject.toml and revert the Dockerfile back to --extra all (keeping your other --extra anthropic/bedrock/azure-identity/hindsight args, which are unchanged). Keep the .dockerignore and layer-reordering changes — those are the real improvements and I'd approve them on their own.
(If the intent is to guarantee [dev] can never leak into the image, note [all] already excludes it; a regression guard test asserting dev ∉ all would express that intent without a duplicate extra.)
Reviewed by Hermes Agent (diffed the new [docker] extra against [all] on origin/main — identical membership).
The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
|
@austinpickett Addressed your review — removed the redundant extra and reverted to . The extra now matches main exactly (no added). Kept the additions and frontend build layer reordering. Ready for re-review. |
Requested change addressed: the author removed the redundant [docker] extra (commit dc5751f) and reverted to --extra all, exactly as this review asked. Verified against current origin/main — [all] already excludes [dev] (2026-05-12 policy), so the surviving changes are just the .dockerignore additions + frontend-build layer reorder, both of which this review explicitly approved. Built the image on amd64 + arm64 (qemu): clean build, dashboard/TUI assets ship, gateway imports, pytest/ruff correctly absent. Dismissing the stale block.
…t build layers (NousResearch#38749) * fix(docker): optimize image size with .dockerignore, drop dev deps, split build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately. * fix(docker): remove redundant [docker] extra, revert to --extra all The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
…t build layers (#38749) * fix(docker): optimize image size with .dockerignore, drop dev deps, split build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately. * fix(docker): remove redundant [docker] extra, revert to --extra all The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
…t build layers (NousResearch#38749) * fix(docker): optimize image size with .dockerignore, drop dev deps, split build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately. * fix(docker): remove redundant [docker] extra, revert to --extra all The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
…t build layers (NousResearch#38749) * fix(docker): optimize image size with .dockerignore, drop dev deps, split build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately. * fix(docker): remove redundant [docker] extra, revert to --extra all The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
…t build layers (NousResearch#38749) * fix(docker): optimize image size with .dockerignore, drop dev deps, split build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately. * fix(docker): remove redundant [docker] extra, revert to --extra all The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
…t build layers (NousResearch#38749) * fix(docker): optimize image size with .dockerignore, drop dev deps, split build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately. * fix(docker): remove redundant [docker] extra, revert to --extra all The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
…t build layers (NousResearch#38749) * fix(docker): optimize image size with .dockerignore, drop dev deps, split build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately. * fix(docker): remove redundant [docker] extra, revert to --extra all The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
…t build layers (NousResearch#38749) * fix(docker): optimize image size with .dockerignore, drop dev deps, split build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately. * fix(docker): remove redundant [docker] extra, revert to --extra all The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
…t build layers (NousResearch#38749) * fix(docker): optimize image size with .dockerignore, drop dev deps, split build layers Three changes to reduce the Docker image size and speed up rebuilds: 1. .dockerignore — exclude ~69 MB of files that are never needed inside the container: apps/ (desktop Tauri source), tests/, website/ (Docusaurus), docs/, infographic/, nix/, plans/, packaging/, and various dotfiles (.envrc, .hadolint.yaml, .mailmap, etc.). The existing .dockerignore already covered node_modules and .git; these additions prevent the remaining non-runtime content from inflating both the build context and the final image (COPY . .). 2. pyproject.toml — add a [docker] extra that mirrors [all] but omits [dev] (debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, setuptools). The published image doesn't need test/debug tooling. Estimated savings: ~30-50 MB of Python packages. 3. Dockerfile — use --extra docker instead of --extra all in the uv sync layer. Also split the COPY + npm run build so that the web/ and ui-tui/ frontend builds are cached independently from Python source changes (COPY . .). A Python-only commit no longer invalidates the (slower) frontend build layer. Note: the build-only apt packages (gcc, python3-dev, libffi-dev, libolm-dev) are still installed in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor tracked separately. * fix(docker): remove redundant [docker] extra, revert to --extra all The [docker] extra was identical to [all] on main — the PR had added [dev] to [all] then created [docker] as [all] minus [dev], a no-op round-trip. Revert [all] to its original form and drop the [docker] extra. Keep the .dockerignore additions and frontend build layer reordering.
What
Three targeted changes to shrink the Docker image and speed up rebuilds:
1.
.dockerignore— exclude ~69 MB of non-runtime contentThe existing
.dockerignorealready excludednode_modulesand.git(~1.6 GB). This PR adds the remaining directories that are never needed inside the container:apps/tests/website/docs/infographic/plugins/hermes-achievements/docs/nix/+flake.*plans/+.plans/packaging/assets/,acp_registry/.env.example,.envrc,.hadolint.yaml,.mailmap,.gitattributesImpact: ~69 MB less build context transferred to the Docker daemon, and ~69 MB less content surviving into the final image via
COPY . ..2.
pyproject.toml— new[docker]extra (drops[dev])[all]includes[dev], which pulls in debugpy, pytest, pytest-asyncio, pytest-timeout, ty, ruff, and setuptools — none needed in the published image. The new[docker]extra is[all] - [dev].Impact: ~30–50 MB fewer Python packages in the image.
3.
Dockerfile— use--extra docker+ split COPY for layer cachinguv sync --extra all→uv sync --extra dockerweb/+ui-tui/) now has its own COPY layer, cached independently from Python source changes. A Python-only commit no longer triggers a redundant web/TUI rebuild.What is NOT included (future work)
The build-only apt packages (
gcc,python3-dev,libffi-dev,libolm-dev) remain in the final image. Removing them requires a true multi-stage build (builder → runtime), which is a larger refactor because the runtime code usesPath(__file__).parent.parentto locateoptional-mcps/and.hermes_build_sha— the editable install and full source tree must survive into the runtime stage.Estimated total impact