Skip to content

Cache Rust dependencies in a separate Docker layer - #76

Merged
Insprill merged 1 commit into
Insprill:masterfrom
vlnst:docker-dep-cache
Oct 18, 2026
Merged

Insprill merged 1 commit into
Insprill:masterfrom
vlnst:docker-dep-cache

Conversation

@vlnst

@vlnst vlnst commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

The Dockerfile copies the whole source tree before running cargo, so any change rebuilds every dependency from scratch, and the gha layer cache never helps.

This builds the dependencies first against a placeholder main.rs, so that layer only changes when Cargo.toml or Cargo.lock do. Locally a source-only rebuild went from 100s to 48s; most of what remains is the LTO link of the final binary.

@Insprill
Insprill merged commit 79a128b into Insprill:master Oct 18, 2026
1 check passed
@vlnst
vlnst deleted the docker-dep-cache branch November 10, 2026 00:37
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.

2 participants