ci(docker): bake toolchains into build image, drop redundant CI installs - #2246
Open
noron12234 wants to merge 1 commit into
Open
ci(docker): bake toolchains into build image, drop redundant CI installs#2246noron12234 wants to merge 1 commit into
noron12234 wants to merge 1 commit into
Conversation
Fixes TEN-framework#917. The ten_building_ubuntu2204 image already provides most of the compiler toolchain, but Node.js was missing and CI workflows re-installed Rust nightly and Go 1.24.3 on every job. As a result, jobs that run inside the container still ran `actions/setup-node@v4`, `rustup update nightly`, and `go install golang.org/dl/go1.24.3@latest` for no reason. Build-time image (tools/docker_for_building/ubuntu/22.04/Dockerfile): * Add Node.js 20 (LTS) via NodeSource so container jobs no longer need actions/setup-node. * Pre-install Go 1.24.3 alongside the existing Go 1.20.12 and Go 1.22.3 so CI does not need `go install golang.org/dl/go1.24.3@latest`. * Install `stable` and latest `nightly` Rust toolchains alongside the pinned `nightly-2025-09-18` default so debug/release matrix jobs can switch toolchains with `rustup default` alone. CI workflows: * linux_ubuntu2204.yml — remove 6 redundant `actions/setup-node@v4` steps in container-based jobs (keep the one in test-integration-python, which runs on a bare ubuntu-22.04 runner). Drop the now-redundant `go install golang.org/dl/go1.24.3@latest` and `rustup update nightly` calls in the build job. * codeql.yml — remove the redundant `actions/setup-node@v4` step. Runtime image (ai_agents/Dockerfile): * Add header comments to both stages making the build-vs-runtime split explicit, per the issue description. No functional change; runtime base image and installed packages are unchanged so deployed images are byte-identical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #917.
Problem
Issue #917 asks to (1) differentiate build-time vs runtime Docker images and (2) bake toolchains into the build-time image so CI doesn't have to install them on every job.
Today, jobs that run inside
ghcr.io/ten-framework/ten_building_ubuntu2204still spend 1-3 minutes per matrix cell re-installing tools that "should" already be in the image:actions/setup-node@v4runs 6× inlinux_ubuntu2204.ymland 1× incodeql.yml— Node was never actually pre-installed in the image.go install golang.org/dl/go1.24.3@latestruns on every build.rustup update nightlyruns on every debug build;rustup default stableruns on every release build. The image only ships the pinnednightly-2025-09-18.On top of that,
ai_agents/Dockerfileis already multi-stage but the build/runtime distinction is not obvious to a first-time reader.Fix
tools/docker_for_building/ubuntu/22.04/Dockerfilestableand latestnightlyRust toolchains alongside the pinnednightly-2025-09-18default..github/workflows/linux_ubuntu2204.ymlactions/setup-node@v4steps in container-based jobs. Keep the one intest-integration-python(runs on a bareubuntu-22.04runner, not the container).go install golang.org/dl/go1.24.3@latestandrustup update nightlyin thebuildjob..github/workflows/codeql.ymlactions/setup-node@v4.ai_agents/DockerfileVerification
yaml.safe_load).--default-toolchain nightly-XXXXplustoolchain install stableplustoolchain install nightly): verified in isolated container,rustup defaultswitches cleanly.docker buildof the build-time image was attempted but is a 30+ min job; the definitive rebuild+publish happens in CI via.github/workflows/build_docker.ymlon merge.Why this way (vs alternatives)
test-integration-python'ssetup-node: that job runs on a bare runner (ubuntu-22.04) for disk-space reasons. Removing it there would break Node.stable+ latestnightlyalongside pinned nightly: keeps the pinned nightly as default (unchanged behavior), and lets release/debug matrix cells switch viarustup defaultalone with zero network I/O.ai_agents/Dockerfileruntimeapt-getlist untouched:python3-pip/python3-dev/python3-venvare technically build tools, but downstream Python extensions may install packages at container run time. Removing them is a separate risk I didn't want to bundle with this PR.Trade-offs
Image size will grow from ~3.9 GB to ~5.5 GB (Rust extras + Node). Net CI cost is a win: every job saves 1-3 min setup time × N matrix cells; concrete savings will show in the CI on this PR once
build_docker.ymlrebuilds and republishes the image to ghcr.