Skip to content

Drop the base image's unused parts (~800 MB smaller) - #50

Merged
rangoDJ merged 2 commits into
mainfrom
feature/slim-image
Oct 7, 2026
Merged

rangoDJ merged 2 commits into
mainfrom
feature/slim-image

Conversation

@rangoDJ

@rangoDJ rangoDJ commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Fixes #49

What changed

  • Build stage slim runs scripts/slim_base.sh on baseimage-selkies: purges Docker-in-Docker (amd64 only), gcc/g++/cmake/make/git and locales-all, regenerates only en_US.UTF-8, removes the Noto CJK serif fonts, and cleans apt state. It purges only installed packages, and refuses if apt would also remove a package the base installs on purpose (apt-mark showmanual).
  • Final image starts FROM scratch and copies the slim stage's filesystem, since deleting files in a later layer can't shrink an image. The base image's ENV and ENTRYPOINT are re-declared; scripts/check_base_env.sh fails the build if they drift from the base. START_DOCKER=false (the base's svc-docker then just sleeps).
  • A smoke test at the end checks Selkies' Python packages, the session binaries (Xvfb, nginx, pulseaudio, openbox, xdotool, xclip, xterm, xfreerdp3, xtigervncviewer, sshpass, s6-rc) and the en_US.UTF-8 locale.
  • Dropped python3-pip (the venv brings its own pip). README: new "Image Size" section.

Update size

The slim layer depends only on the base image and slim_base.sh, so CI's GHA layer cache keeps it, and its digest, unchanged between ConnectHub releases: updates still download only ConnectHub's layers. A cache miss (eviction) produces a new slim layer and one full download.

Testing

  • check_base_env.sh tested in WSL: accepts a matching environment, rejects a changed value, a missing variable and a PATH not ending in the base's.
  • Shell syntax checked for both scripts.
  • Image size and startup: being tested on the Docker host from a manual build of this branch (sha-09c95c9); results to follow in a comment.

🤖 Generated with Claude Code

rangoDJ and others added 2 commits October 7, 2026 18:22
89% of the image is one baseimage-selkies layer, which ships Docker-in-
Docker, the C/C++ toolchain, hundreds of compiled locales and CJK serif
fonts that ConnectHub never uses. Deleting them in a later layer can't
shrink the image, so a build stage removes them and its filesystem is
copied into a fresh image.

- slim_base.sh purges only installed packages (Docker is amd64-only) and
  refuses if apt would take a package the base installs on purpose
- the base's ENV/ENTRYPOINT are re-declared; check_base_env.sh fails the
  build if they drift from the base image
- START_DOCKER=false; a final smoke test checks the session's binaries,
  Selkies' Python packages and the en_US.UTF-8 locale

Fixes #49

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BuildKit sets TRACEPARENT (and TRACESTATE) to a new value in every RUN, so
the base image's recorded value could never match and the build failed.
Also report every mismatch at once instead of stopping at the first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rangoDJ
rangoDJ merged commit 46f1c72 into main Oct 7, 2026
8 checks passed
@rangoDJ
rangoDJ deleted the feature/slim-image branch October 7, 2026 22:35
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.

Slim the image: drop base-image parts ConnectHub doesn't use (~800 MB)

1 participant