WIP: add option to build Alpine Linux image for Substrate builder to generate 236MB image size#2
Closed
ltfschoen wants to merge 1 commit intoluke/2464-optimise-dockerfrom
Closed
Conversation
* it currently works because i used this tip https://dev.classmethod.jp/articles/docker-alpine-glibc-error/ and reverted to using older version 2.34-rc0 and commented out the line `# ldd ...`, but when you run `docker run --rm -it parity/substrate substrate --version` it outputs the following, where the version is shown after other logs. the other commands work so you can run a node: ``` substrate: /usr/lib/libstdc++.so.6: no version information available (required by substrate) │ substrate 3.0.0-dev-unknown ``` the image size is 236MB, where the `rm -rf` lines reduce it down from 250MB parity/substrate latest d7b25e32abae Less than a second ago 236MB │ parity/substrate v3.0.0 d7b25e32abae Less than a second ago 236MB size of binaries that are built are: chain-spec-builder 21MB node-template 74.5MB subkey 11.5MB substrate 96.5MB note: after building them i copied them to local machine with `docker cp <CONTAINER_ID>:/usr/local/bin/substrate ./tmp/` and modified the dockerfile to copy the built ones across to avoid having to compile to debug. if i uncomment `ldd ...`, then when i run ./build.sh it outputs: ``` ``` if i use 2.35-rc0 then run ./build.sh it outputs ``` ```
4 tasks
4 tasks
ltfschoen
pushed a commit
that referenced
this pull request
Aug 19, 2023
* Cherry pick all crypto related changes from pull-request paritytech#13311 applied to master's head * Import some stuff just if 'full_crypto' is on * Remove copyright year * Cleanup * First generic BLS draft * Finalize generic implementation * Restore tests * Fix rust docs * Fix after master merge * Fix after master merge * Use double bls with G1 as signature group and verify individual signatures using DLEQ proof. * Fix inclusions and types used within substrate * Remove unused cruft * Restore usage of upstream crates * Fix test * Reduce the diff by aligning Cargo.lock to master * Application-crypto provides bls381 * Implement bls381 for local keystore * Use new generic keystore features * import DoublePublickey[Scheme] from the bls-like root to be less confusing. * fix compilation * Apply suggestions from code review Co-authored-by: Robert Hambrock <roberthambrock@gmail.com> * Clean leftovers * - update bls test vector after applying spec change recommendation. - send message as ref. * Different hard junction ids for different bls12 types * update to new bls-like * bls-like → w3f-bls * Make clippy happy * update test vector after replacing hash and crop with hash to field. * cargo fmt * account for paritytech#13972 * hide BLS behind "bls_non_production" feature flag * Remove Cargo.lock entries duplicated in merge * add bls377 to primitives/keystore and client/keystore add bls377 to primitives/application-crypto/ add bls_non_production to primitives/keystore and client/keystore bump up w3f-bls version * rename feature `bls_non_production` to `bls-experimental` --------- Co-authored-by: Davide Galassi <davxy@datawok.net> Co-authored-by: André Silva <andrerfosilva@gmail.com> Co-authored-by: Robert Hambrock <roberthambrock@gmail.com>
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.
# ldd ..., but when you rundocker run --rm -it parity/substrate substrate --versionit outputs the following, where the version is shown after other logs. the other commands work so you can run a node:there are a lot of open issues in the repository that i'm using https://github.com/sgerrand/alpine-pkg-glibc that are likely the cause of the error
the image size is 236MB, where the
rm -rflines reduce it down from 250MBsize of binaries that are built are:
chain-spec-builder 21MB
node-template 74.5MB
subkey 11.5MB
substrate 96.5MB
note: after building them i copied them to local machine with
docker cp <CONTAINER_ID>:/usr/local/bin/substrate ./tmp/and modified the dockerfile to copy the built ones across to avoid having to compile to debug.if i uncomment
ldd ..., then when i run ./build.sh it outputs:if i use 2.35-rc0 then run ./build.sh it outputs
prior to using fetching the glibc from the https://github.com/sgerrand/alpine-pkg-glibc repository in the dockerfile, i was just using default alpine which uses busybox instead, so the dockerfile just had:
instead of all this snippet
i compared the ubuntu and alpine image sizes, where latest alpine is 3.17
inspected the image and its file size breakdown and its user groups
and then in the dockerfile i just did;
but it still gave errors when running ./build.sh (note how these are busybox errors rather than glibc errors
which overcame a lot of the folllowing errors: