Repository navigation
ci(docker): speed up the image build - #121
Merged
Merged
Conversation
- Install SAM CLI from its official installer (pinned, SHA-256 checked) and Snowflake CLI into its own venv. Sharing one venv made pip backtrack over conflicting `rich` pins (100 s amd64, 18 min arm64 under QEMU) and pick SAM 1.142.1 and Snowflake CLI 3.16.0. - Build the JS builder stage on $BUILDPLATFORM, so multi-arch builds compile dist/ once instead of once per platform under QEMU. - Check each tool's version in its own layer instead of in a final step that reran on every commit. - Drop the GHA build cache: exporting it took 5-19 min per smoke run, even when every layer was a cache hit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
joe4dev
force-pushed
the
speed-up-docker-build
branch
from
November 18, 2026 12:46
6275a0b to
0dd5332
Compare
joe4dev
marked this pull request as ready for review
November 18, 2026 13:04
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.
Summary
Follow-up to #97. It cuts the Docker workflow time: main pushes took 35–46 min and PRs 5–27 min, almost all of it in the image build rather than the tests. The CI logs point to four causes, each fixed here.
pip install aws-sam-cli snowflake-cliinto one venv backtracks:snowflake-clipinsrich==14.0.0,aws-sam-clineedsrich>=14.3.3cache-to: type=gha,mode=maxexport insmokeyarn install) runs once per platform under QEMUFROM --platform=$BUILDPLATFORMfor the builder;dist/is plain JSRUNprinting tool versions comes afterCOPY dist, so it reruns every commitdistanddockerodeSnowflake's official
.debwas tried first and rejected: it is a PyApp binary that unpacks about 400 MB of Python into$HOMEon first run. That doubled the image, and every non-root session unpacked it again.Evidence
Uncached local builds on an Apple Silicon Mac (Docker Desktop; amd64 is emulated):
main(after #97)docker save(arm64 / amd64)snow --versionSame behaviour on both images:
sam buildsucceeds for a python3.11 function with arequestsdependency and a nodejs22.x function withlodash.pip install --targetis exempt from PEP 668, so dropping the shared venv fromPATHchanges nothing here.snow --versionworks as root, as--user 1000, and with--read-only.tests/docker/validate-image.mjswith the CI smoke settings:tools/list exposes all 15 tools.Local Docker Desktop emulation is much faster than QEMU on GitHub runners, so the arm64 push job should gain more than the table shows. This PR's
smokejob gives the real CI numbers; the multi-archpushjob only runs on main.Not run locally: the integration test with real Terraform and CDK deploys. This PR's
smokejob runs it.Merge Danger
Door: two-way
Blast Radius: Docker image users, CI
python3/pipin the image are now Debian's, not a venv's. Only people who extend the image withFROMandpip installinto it notice.python3-venvstays installed.snowflake-cli==3.34.0, as before. A hashed lockfile is a possible follow-up.SAM_CLI_*/SNOWFLAKE_CLI_VERSIONARGs. A Renovate regex manager or a bump script is a possible follow-up, as is building arm64 on nativeubuntu-24.04-armrunners instead of QEMU.🤖 Generated with Claude Code