Repository navigation
perf(docker): skip make install, copy vizd binary directly - #98
Merged
Merged
Conversation
`make install` triggers CMake's install-depends-on-all rule, which rebuilds every target in the build graph (cli_wallet, util programs, graphene_wallet, appbase_example, chainbase_test) — including the ones we deliberately skipped via `make -j$(nproc) vizd` in the prior step. Measured cost on warm path: ~3 minutes of redundant compile. The runtime image only invokes /usr/local/bin/vizd (see share/vizd/vizd.sh), so we copy the single binary directly. The multi-stage final image still starts from a clean base, so nothing in /usr/local except vizd matters. Drops the trailing `rm -rf $APPDIR` because the builder stage is discarded in multi-stage; the rm contributed nothing but I/O. Expected impact on PR-warm path: - before: 4m50s (build #18 ~24s + make install #19 ~177s + push) - after: ~1m45s (build #18 ~24s + cp ~0s + push) Cold path saves the same ~3 min for the same reason.
Two related image-trimming changes: 1) Multi-stage final COPY only brings the vizd binary, not the entire builder /usr/local. The runtime image only invokes /usr/local/bin/vizd (see share/vizd/vizd.sh) and the static link (-DBUILD_SHARED_LIBRARIES=FALSE) means no .so dependencies. The tighter COPY shrinks the runtime layer and the graph exported to GHA layer cache. 2) Drop the trailing builder-stage cleanup RUN (apt-get clean + autoremove + rm -rf). The accompanying comment claimed the step "removes anything that landed in real layers," but the entire builder stage is discarded by multi-stage build — its real layers never reach the runtime image. The step was dead code. Both changes preserve runtime behavior and reduce per-build work.
chiliec
force-pushed
the
ci/skip-make-install
branch
from
April 28, 2026 11:54
822ec91 to
f9463f4
Compare
chiliec
marked this pull request as ready for review
April 28, 2026 12:21
6 of 8 tasks
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
Stack of three perf changes on top of #97. Drops a hidden ~3 min recompile and trims the runtime image footprint by 33%.
Background
PR #97 scoped the build to
make -j$(nproc) vizd, which only compiles the daemon binary and skipscli_wallet, util programs, tests, and examples. But the subsequentmake installstep silently re-triggers CMake'salltarget, rebuilding everything that step #18 deliberately skipped. Confirmed by inspecting #97's warm-build log of run25041089256(#19 elapsed 177s, log shows compilations ofappbase_example,chainbase_test,graphene_wallet, etc.).After fixing that, profiling the warm path showed two more cheap wins around the same Dockerfile area: the multi-stage final COPY brings the entire builder
/usr/local(most of which is just the base-image directory tree) and a trailing builder-stage cleanupRUNruns in a stage that's discarded by multi-stage anyway.Changes
1. Skip
make install, copy the binary directlyThe runtime image only invokes
/usr/local/bin/vizd(seeshare/vizd/vizd.sh). No.sodeps from the project's own libs (-DBUILD_SHARED_LIBRARIES=FALSE). The trailingrm -rf \$APPDIRwas a no-op anyway because the builder stage is discarded in multi-stage.2. Tighten the multi-stage final COPY
Runtime image now contains exactly the binary that gets executed, on top of phusion noble's untouched
/usr/local. Smaller layer to push to Docker Hub, smaller graph to export to GHA layer cache.3. Drop the wasted builder-stage cleanup
RUNThe trailing
RUN apt-get clean && apt-get autoremove -y && rm -rf ...ran in the builder stage, which is discarded by multi-stage. The accompanying comment claimed the step "removes anything that landed in real layers," but those real layers never reach the runtime image. Dead code.Measured results
Run `25051281884`, `Dockerfile-production`:
*Cold +31s vs commit 1 is GHA runner variance, not a regression — the layer graph and steps are smaller. Warm run confirms the trend.
Where the A+B savings landed (warm):
Cumulative result vs the original baseline (no caching, every PR cold ~20-40 min): warm path went from ~30 min to 1m27s — over 20× faster.
What does `make install` install that we're now skipping?
The CMake `install` target writes these to `/usr/local/bin` (and headers under `/usr/local/include`):
None are referenced by the runtime image. The Docker images don't ship `cli_wallet` (it wasn't useful inside a daemon container). For local development, `make install` on the host build still works as before — this PR only affects the Dockerfile RUN steps.
Maintenance note
If a future change adds a runtime artifact that the Docker image needs (e.g. a helper binary), the explicit `cp` line and the multi-stage `COPY` need to be extended. The trade is: a small hand-maintained list (visible at a glance in the Dockerfile) for a faster build and a slimmer image on every CI run.
Validation
All checks performed against the pushed `vizblockchain/vizd:ci-skip-make-install` image (linux/amd64) using the Docker Hub registry API — no docker daemon required:
The "actually exec the binary" smoke test would need a docker daemon, but with the static analysis above (binary is a valid ELF, all dynamic deps are present in the base image, the binary contains expected vizd config strings), the residual risk is essentially zero.
🤖 Generated with Claude Code