fix(docker): optimize image size — .dockerignore, drop dev deps, split 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.
This commit is contained in:
@@ -63,3 +63,45 @@ data/
|
||||
# Compose/profile runtime state (bind-mounted; avoid ownership/secret issues)
|
||||
hermes-config/
|
||||
runtime/
|
||||
|
||||
# ---------- Not needed inside the Docker image ----------
|
||||
|
||||
# Desktop app source (Tauri/Electron); never installed in the container
|
||||
apps/
|
||||
|
||||
# Test suite — not shipped in production images
|
||||
tests/
|
||||
|
||||
# Documentation site (Docusaurus) and supplementary docs
|
||||
website/
|
||||
docs/
|
||||
|
||||
# Assets only used by the GitHub README
|
||||
assets/
|
||||
infographic/
|
||||
|
||||
# Plugin-level docs (hermes-achievements ships docs/ but the runtime doesn't read them)
|
||||
plugins/hermes-achievements/docs/
|
||||
|
||||
# Nix / Homebrew / AUR packaging metadata — irrelevant to Docker
|
||||
nix/
|
||||
flake.nix
|
||||
flake.lock
|
||||
packaging/
|
||||
|
||||
# Design and planning documents
|
||||
plans/
|
||||
.plans/
|
||||
|
||||
# ACP registry manifest (icon + agent.json) — not consumed at runtime
|
||||
acp_registry/
|
||||
|
||||
# Repo-level dotfiles that are git-only or dev-tooling config
|
||||
.env.example
|
||||
.envrc
|
||||
.gitattributes
|
||||
.hadolint.yaml
|
||||
.mailmap
|
||||
|
||||
# Top-level LICENSE (not matched by *.md); not needed inside the container
|
||||
LICENSE
|
||||
|
||||
Reference in New Issue
Block a user