Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimizes docker layer #337

Merged
merged 4 commits into from
Mar 16, 2022
Merged

Optimizes docker layer #337

merged 4 commits into from
Mar 16, 2022

Conversation

ggera
Copy link
Member

@ggera ggera commented Mar 11, 2022

Optimizes kilt-node docker layers: Check polkadot builder for comparison https://github.com/paritytech/polkadot/blob/master/scripts/dockerfiles/polkadot/polkadot_builder.Dockerfile

How to test:

Build a docker image and test if number of layers is lowwered and build time is imrpoved

Checklist:

  • I have verified that the code works
    • No panics! (checked arithmetic ops, no indexing array[3] use get(3), ...)
  • I have verified that the code is easy to understand
    • If not, I have left a well-balanced amount of inline comments
  • I have left the code in a better state
  • I have documented the changes (where applicable)

@ggera ggera marked this pull request as draft March 11, 2022 09:53
@ggera ggera requested review from tjwelde and weichweich March 11, 2022 10:01
@ggera ggera marked this pull request as ready for review March 11, 2022 12:26
@tjwelde
Copy link
Contributor

tjwelde commented Mar 11, 2022

I was seeing that they changed their Dockerfiles, too so I agree with aligning. @weichweich will have to approve though, since he can judge the changes better here.

@ggera ggera merged commit 76025b1 into develop Mar 16, 2022
@ggera ggera deleted the optimize-docker-layer branch March 16, 2022 10:39
ntn-x2 pushed a commit that referenced this pull request Mar 25, 2022
* Adds copy all files in a sigle layer command

* Removes unused docker layer

* Changes debian image to ubuntu

Co-authored-by: Albrecht <albrecht@kilt.io>
(cherry picked from commit 76025b1)
ntn-x2 added a commit that referenced this pull request Mar 25, 2022
* Adds two more relaychain bootnodes for staging environment  (#334)

* Adds two more bootnodes for staging environment closes #1864

* Fixes staging parachain bootNodes

(cherry picked from commit 73097ff)

* ci: use caching

(cherry picked from commit aafb1a9)

* chore: reset peregrine stg (#335)

* reset peregrine stg

* delete tmp files

(cherry picked from commit f27917c)

* chore: minor peregrine-stg fix

(cherry picked from commit c2819c9)

* fix: swapped ed & sr keys

(cherry picked from commit dcb7afa)

* fix: peregrine-stg bootnodes

(cherry picked from commit 30b1cfa)

* fix: peregrine-stg parachain nodes

(cherry picked from commit 896f01a)

* fix: peregrine-stg node identity

(cherry picked from commit b84dbda)

* ci: use custom ci image (#336)

* switch to own ci image

skipping one step should speed up the build

* add ci dockerfile

* add tag

(cherry picked from commit e999bfb)

* Optimizes docker layer (#337)

* Adds copy all files in a sigle layer command

* Removes unused docker layer

* Changes debian image to ubuntu

Co-authored-by: Albrecht <albrecht@kilt.io>
(cherry picked from commit 76025b1)

* chore: update toolchain version to nightly 1.59 (#339)

* chore: bump up toolchain to nightly 1.59

* chore: address Clippy warnings

(cherry picked from commit 80182c5)

* fix: add did lookup pallet to DID authorization logic + reverse lookup index (#343)

* fix: add did lookup pallet to DID authorization logic

* test: add unit tests for spiritnet and peregrine runtimes for correct DID verification key derivation

* chore: clippy

* feat: add additional map for reverse index

* test: add unit tests

* chore: update benchmarks checks

* wip: runtime upgrade scripts

* wip: lookup pallet migration

* chore: update toolchain version to nightly 1.59 (#339)

* chore: bump up toolchain to nightly 1.59

* chore: address Clippy warnings

* wip: benchmarks

* bench: benchmark compiling

* chore: try-runtime complete

* chore: update deps

* chore: add migrations to Spiritnet runtime

* chore: add comment in lookup migration

* chore: move migration into lookup pallet

* fix: add try-runtime feature to did lookup crate

* chore: fixes after rebase

* chore: fmt

* chore: ConnectedAccounts map comment

* cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet-did-lookup --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallets/pallet-did-lookup/src/default_weights.rs --template=.maintain/weight-template.hbs

* cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet-did-lookup --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/pallet_did-lookup.rs --template=.maintain/runtime-weight-template.hbs

* cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=pallet-did-lookup --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/pallet_did-lookup.rs --template=.maintain/runtime-weight-template.hbs

* bench: update benchmarks to include account replacement as worst case

* bench: fix InsufficientFunds error in benchmarks

* chore: fmt

* cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet-did-lookup --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallets/pallet-did-lookup/src/default_weights.rs --template=.maintain/weight-template.hbs

* chore: update comments

* cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet-did-lookup --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/pallet_did-lookup.rs --template=.maintain/runtime-weight-template.hbs

* cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=pallet-did-lookup --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/pallet_did-lookup.rs --template=.maintain/runtime-weight-template.hbs

Co-authored-by: kiltbot <>
(cherry picked from commit ff34f86)

* feat: proxy type for disableling deposit claiming (#341)

* proxy type for disableling deposit claiming

* fix

* fix: explicit proxy pallet logic for peregrine runtime

* fix: finalise proxy definition for spiritnet

* chore: add explicit encoding value for proxy types

* chore: update mashnet-node with similar proxy structure as peregrine

* chore: clippy

* cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet-proxy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/peregrine/src/weights/pallet_proxy.rs --template=.maintain/runtime-weight-template.hbs

* cargo run --quiet --release -p kilt-parachain --features=runtime-benchmarks -- benchmark --chain=spiritnet-dev --steps=50 --repeat=20 --pallet=pallet-proxy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./runtimes/spiritnet/src/weights/pallet_proxy.rs --template=.maintain/runtime-weight-template.hbs

Co-authored-by: Antonio Antonino <antonio@kilt.io>
Co-authored-by: kiltbot <>
(cherry picked from commit a402710)

* fix: pallet_did_lookup weights filename

* chore: bump pallet and runtime versions

Co-authored-by: Gerawork Aynekulu <ggera@users.noreply.github.com>
Co-authored-by: weichweich <albrecht@kilt.io>
Comment on lines -11 to -16
COPY ./nodes /build/nodes
COPY ./pallets /build/pallets
COPY ./runtimes /build/runtimes
COPY ./support /build/support
COPY ./Cargo.lock /build/Cargo.lock
COPY ./Cargo.toml /build/Cargo.toml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither new nor old are great. If there is any layer caching at all, Cargo.toml and Cargo.lock should be copied first, dependencies installed (those don't change often) and then the rest of the code should be copied and the project itself compiled. This way code changes don't result in rebuilding of everything.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip! We had dependency caching in our Dockerfile a while ago but experienced some issues. In the end there where some compile errors because of the dependency caching. This and the not so huge improvement by the cache lead us to remove the caching again. Last time we where hoping that cargo-wharf would solve the caching, but it looks like no development was done in 2y.

@@ -2,6 +2,8 @@
.github
.gitignore
.gitlab-ci.yml
.rustfmt.toml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring everything and the un-ignoring things that are actually needed for build is typically a more productive approach than block-listing

ntn-x2 added a commit that referenced this pull request Jun 24, 2022
* Adds two more relaychain bootnodes for staging environment  (#334)

* chore: reset peregrine stg (#335)

* ci: use custom ci image (#336)

* Optimizes docker layer (#337)

* fix: add did lookup pallet to DID authorization logic + reverse lookup index (#343)

* chore: update toolchain version to nightly 1.59 (#339)

* feat: proxy type for disableling deposit claiming (#341)

* fix: rococo protocol id (#369)

* feat: generic access control (#316)

* Updates toolchain version (#345)

* refactor: enforce no runtime in pallet (#349)

* fix: features (#353)

* feat: add tips pallet (#352)

* feat: upgrade to Polkadot v0.9.19 (#357)

* chore: upgrade and clean up (#360)

* Adds the new rococo chainspec (#363)

* feat: add launch pallet removal migration (#359)

* refactor: update rilt para id from 2015 to 2108 (#364)

* fix: rilt para id (#365)

* feat: upgrade to Polkadot v0.9.23 (#366)

* use ci-linx:production base image (#368)

* feat: upgrade to Polkadot v0.9.24 (#370)

* fix: fix CI builders compilation errors and pin to a specific hash (#372)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants