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

Try to speedup dockerfile build time #2264

Merged
merged 31 commits into from
Aug 4, 2022
Merged

Conversation

ValarDragon
Copy link
Member

@ValarDragon ValarDragon commented Jul 31, 2022

What is the purpose of the change

  • Reorder cosmwasm steps to come earlier in dockerfile
  • Run go mod download to cache the go dependency downloads. (Shaves ~30 seconds as far as I can tell)
  • Use RUN --mount=type=cache to speedup repeat docker builds locally. (See below for why this doesn't work in CI, I tried a few times, at some point github cache stopped working, so I quit trying)
  • Rename github action steps to be more concise
  • Combine a few of the prior layers

Brief Changelog

Add go cache to dockerfile

Testing and Verifying

This change is already covered by E2E tests

@github-actions github-actions bot added the C:docs Improvements or additions to documentation label Jul 31, 2022
@github-actions github-actions bot added the T:CI label Jul 31, 2022
@ValarDragon
Copy link
Member Author

This is sad :(

You need to use RUN --mount=type=cache to get golang cache used in docker build steps. This works locally. But its been an open issue for years, to get it working in CI's:

Two repo workarounds:

The first repo copies the entire internal dockerkit local directory via CI into github action cache, but this is overly expensive. (Your adding a minute due to its size of excess data per github issue reports. Still would net save us 1.5 minute tho) This is what the first repo does.

Ideally we could just copy the relevant part of the internal buildkit cache state, unsure if theres documentation on where this all goes. (Maybe thats what the second repo does)

@ValarDragon
Copy link
Member Author

Wait maybe we can just copy out the relevant buildkit cache:

$ ls /var/lib/docker/buildkit
cache.db  containerdmeta.db  content  executor	metadata_v2.db	net  snapshots.db

@github-actions github-actions bot removed the T:CI label Aug 1, 2022
@ValarDragon ValarDragon marked this pull request as ready for review August 1, 2022 03:03
@ValarDragon ValarDragon requested a review from a team August 1, 2022 03:03
@github-actions github-actions bot added the T:CI label Aug 1, 2022
Copy link
Member

@niccoloraspa niccoloraspa left a comment

Choose a reason for hiding this comment

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

LGTM. 🚀

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

LGTM!

@ValarDragon ValarDragon merged commit 25db335 into main Aug 4, 2022
@ValarDragon ValarDragon deleted the dev/try_speedup_build branch August 4, 2022 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:docs Improvements or additions to documentation T:build T:CI
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants