Skip to content

perf: slim the base image (drop unconditional build-essential + nodejs) - #17

Open
ai-anant wants to merge 1 commit into
cyfinoid:mainfrom
ai-anant:perf/slim-base
Open

perf: slim the base image (drop unconditional build-essential + nodejs)#17
ai-anant wants to merge 1 commit into
cyfinoid:mainfrom
ai-anant:perf/slim-base

Conversation

@ai-anant

@ai-anant ai-anant commented Aug 2, 2026

Copy link
Copy Markdown

Summary

Two heavy apt packages were installed unconditionally in every aidc image, even for projects that never use them:

  • build-essential (~150 MB with gcc/g++/make) — only needed when a project compiles C code.
  • nodejs 22 (~70 MB + nodesource repo setup) — only needed when the project has a Node toolchain.

Changes (templates/devcontainer/Dockerfile.tmpl)

  • Removed build-essential from the base apt layer.
  • Added build-essential to the rust toolchain armcargo install links C dependencies, so Rust projects genuinely need it.
  • Moved the nodesource repo setup + nodejs into the node toolchain arm — a project with package.json / lockfiles gets Node 22; non-node projects skip it.
  • Kept all interactive/network/firewall tooling (vim, tmux, zsh, fzf, gh, jq, ripgrep, rsync, iptables, ipset, socat, …) — they're small and aidc relies on several (socat for the clipboard bridge, iptables/ipset for the egress firewall, gh for GitHub workflows).

docs/install.md toolchain table updated to reflect that Node is now installed on detection rather than present in the base.

Expected impact

  • ~200–300 MB smaller images for projects that aren't Node-only or C-compiling.
  • No behavior change for Rust projects (build-essential still installed there) or Node projects (nodejs installed on node toolchain detection).
  • AIDC_TOOLCHAINS=node explicit pin still works.

Test plan

  • docker build --check with AIDC_TOOLCHAINS=node,rust — no warnings
  • Full docker build with node,rust toolchains in progress (verifies nodesource arm + build-essential arm end-to-end)
  • bash -n, shellcheck -x, bash-3.2 compat — clean
  • tests/resolve-oauth-token.test.sh — 7/7 pass

Closes #11

- build-essential (~150MB with gcc/g++) was installed for every project;
  it is only needed when a project compiles C. Moved into the 'rust'
  toolchain arm (cargo links C deps when installing crates).
- nodejs 22 was installed unconditionally via the nodesource repo;
  moved to the 'node' toolchain arm so non-node projects skip it.
- Kept all interactive/network/firewall tooling (vim, tmux, zsh, fzf,
  gh, jq, ripgrep, iptables, socat, ...) — they're small and aidc relies
  on several (socat for the clipboard bridge, iptables for the firewall).

Expected saving: ~200-300MB per non-node, non-C project image.

Refs cyfinoid#11
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.

Image size: slim the base image + audit unconditional apt packages (saves 400-600MB)

1 participant