Skip to content

Conversation

@kevaundray
Copy link
Contributor

@kevaundray kevaundray commented Oct 27, 2025

Issue Addressed

Currently whenever we build the Dockerfile file for local development using kurtosis , it recompiles everything on my laptop, even if no changes are made. This takes about 120 seconds on my laptop (might be faster on others).

Proposed Changes

Conservatively, I created a new Dockerfile.dev, so that the original file is kept the same, even though its pretty similar.

This uses --mount-type=cache saving the target and registry folder across builds.

Usage

docker build -f Dockerfile.dev -t lighthouse:dev .

Additional Info

  • If you immediately redo the above command, it should have no effect, ie it shouldn't rebuild
  • Modifying the cli crate gives about a 6x speedup from scratch, and modifying consensus gives about a 2x speedup

@kevaundray
Copy link
Contributor Author

kevaundray commented Oct 27, 2025

Note: the local_testnet kurtosis script has not been changed and still uses Dockerfile

@jimmygchen
Copy link
Member

Thanks @kevaundray, I haven't had a chance to try it out, but this is great!

@jimmygchen jimmygchen added the ready-for-review The code is ready for review label Oct 29, 2025

COPY . .
# Persist the registry and target file across builds. See: https://docs.docker.com/build/cache/optimize/#use-cache-mounts
RUN --mount=type=cache,target=/usr/local/cargo/registry \
Copy link
Member

Choose a reason for hiding this comment

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

Nice I've used this a few times and it seems to have improved. (My machine is slow so I haven't really got enough iterations for measurements)

I noticed the link you provided also suggests mounting this directory, should we include it too?
/usr/local/cargo/git/db

Copy link
Member

Choose a reason for hiding this comment

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

ah so this caches the bare git repos and commits etc, so likely not much time savings in terms of computation. I think we can experiment using this version - I'll make a PR to update the startup script to use this doclerfile.

@jimmygchen jimmygchen added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Nov 24, 2025
Copy link
Member

@jimmygchen jimmygchen left a comment

Choose a reason for hiding this comment

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

This is great, thanks for the PR @kevaundray !

@jimmygchen jimmygchen added ready-for-merge This PR is ready to merge. and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Nov 24, 2025
@mergify mergify bot added the queued label Nov 24, 2025
mergify bot added a commit that referenced this pull request Nov 24, 2025
@mergify mergify bot merged commit 03832b0 into sigp:unstable Nov 24, 2025
37 checks passed
@mergify mergify bot removed the queued label Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devex ready-for-merge This PR is ready to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants