-
Notifications
You must be signed in to change notification settings - Fork 4
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
Optimize docker build, pin rust version, use debian for runtime #23
Conversation
Thanks for the PR,
Since the polkadot-v1.9.0, we are using
Do you know why or have any source about this ? |
Welcome
nightly-2014-01-21 seems not available directly through a docker image but the latest nightly or stable version like 1.77 released on 21/03. Do you think this 1.77 could suits your needs, embedding what nightly-2014-01-21 has? If not, we could compile nightly-2014-01-21 during the build...
My long experience on docker packaging is that each task in Dockefile is automatically cached as long as the running command does not modifying anything or if any previous command is already cached. So, the command copying the code base ("ADD . ." or "COPY . .") on a development branch should be done at the latest possible stage so that everything before can be (ideally) cached. This is explained in the official doc. In the case of the Allfeat package, I have pretty long building time (around 10' on 16 CPU cloud server) because it embeds a lot of dependencies. IMHO a lot of dependency installations could be cached. This is why I'm trying to find a way to have more stages to be sure the code base is compiled after all deps. It seems using cargo-chef is the better approach for now, waiting the feature can be used natively using something like "cargo build --dependencies-only". ATM, from my tests, cargo-chef does not give nothing better, doubling the build time (!). Indeed, it seems the builder does not see the previous deps compiled by chef. So continuing my experiments to drastically reduce the build time... ;) |
If we could have a 1.79 nightly docker image I think that would work fine, you can test it by just changing the rust version in the Reducing the build time is challenging for a Substrate blockchain yeah. I have a bad news about this: It will be important for users to provide a docker image with Allfeat built directly from a CI also in the future. |
2b56c93
to
abb9d54
Compare
LGTM |
* use pinned debian bookworm based image, install debian deps before copying * add before defining workdir * use nightly-bookworm-slim for now
OK of course
Indeed, we could use hub.docker to build the image automatically. But even on this platform, a shorter build time is always better ;) Thanks for the merge. |
FYI @SailorSnoW using
Would it be exclusive to another argument? |
The correct syntax to pass the production profile to cargo is this one normally: |
This is a short PR based on master to :