LightningCreations / LightningCreations/LightningLabsServer
Cache Compiled Dependencies in Dockerfile
- Dominant language
- Rust
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Currently, source code changes to the dockerfile will _always_ recompile _all_ dependencies. This is obviously wasteful of time and uses a bunch of network for no good reason.
It is possible to adjust the dockerfile such that the dependency manifests (Cargo.toml and Cargo.lock) are copied in, a "Hello world" app is built to force Cargo to pull and compile the dependencies, and _then_ the actual server source is copied. This puts the dependency into a layer that doesn't depend on the source code layer, thus preventing them from being recompiled for every source change.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the repository's Dockerfile and inspect how it currently copies the Rust server source and builds dependencies. Separate the Cargo.toml/Cargo.lock dependency layer from the server-source layer, using a temporary Hello World build to populate Cargo's cache; done means source-only changes reuse compiled dependencies during Docker builds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, rust
- Domain
- build-system, devops
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100