Optimize final image: runtime libs instead of -dev, pin base image - #157
Merged
Conversation
The final runtime stage installed full -dev packages (headers, static archives, build-time deps) when only the runtime shared libraries are needed. Replace them with the runtime-only equivalents, verified via `ldd` on the built p2pool binary against the pinned base. Changes: - Final stage: install runtime libs instead of -dev packages (libuv1t64, libzmq5, libsodium23, libpgm-5.3-0t64, libnorm1t64, libgssapi-krb5-2, libcurl4t64, libidn2-0). Note the t64 names on Ubuntu 24.04 due to the 64-bit time_t transition. - Pin both stages to ubuntu:24.04 (current LTS) instead of ubuntu:latest for reproducible builds. Renovate's docker manager keeps this current. - Add --depth 1 --shallow-submodules to the git clone for faster, lighter source checkout. Local verification (native arm64): - Build succeeds (exit 0). - `docker run --rm p2pool:test --help` prints "P2Pool v4.17" + usage. - `ldd` on the binary in the final image: all libs resolve, none missing. - Image size: 317MB -> 188MB (-129MB, -41%). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sethforprivacy
marked this pull request as ready for review
June 23, 2026 11:10
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
The final runtime stage was installing full
-devpackages (headers, static archives, build-time-only deps) when a runtime image only needs the runtime shared libraries. This swaps them for the runtime-only equivalents, pins the base image, and shallow-clones the source.Changes
Runtime libs instead of
-devin the final stage. The authoritative list comes fromlddon the builtp2poolbinary. The direct NEEDED libs map to:-devpackagelibuv1-devlibuv1t64libzmq3-devlibzmq5libsodium-devlibsodium23libpgm-devlibpgm-5.3-0t64libnorm-devlibnorm1t64libgss-devlibgssapi-krb5-2libcurl4-openssl-devlibcurl4t64libidn2-0-devlibidn2-0Several packages carry the
t64suffix on Ubuntu 24.04 (noble) due to the 64-bittime_ttransition — names were verified against the pinned base, not guessed.Pin base image
ubuntu:latest→ubuntu:24.04(both stages) for reproducible builds. Renovate's docker manager will keep it current.--depth 1 --shallow-submoduleson thegit clonefor a faster, lighter source checkout (verified it still builds with all submodules).Measured size delta
ubuntu:latest+-dev)Local verification (native arm64, Apple Silicon)
docker run --rm p2pool:test --help→ printsP2Pool v4.17and full usage (correct smoke test; p2pool needs a monerod to actually mine).ldd /usr/local/bin/p2poolinside the final image → all shared libraries resolve, none "not found" — confirms the runtime-lib swap didn't break the binary.CI
This touches
Dockerfile, so it triggers theTest build of image when Dockerfile is changedworkflow onpull_request.