cloudflare / cloudflare/workers-rs
Pre-built `worker-build` binaries?
- Dominant language
- Rust
- Stars
- 3.7k
- Forks
- 429
- Avg merge
- 20h 28m
- Merged PRs (30d)
- 7
Description
Apologies if I missed an alternative somewhere in the docs, but I noticed that Cloudflare's official template for Rust-based workers does the following for the custom build:
```toml
[build]
command = "cargo install -q \"worker-build@^0.8\" && worker-build --release"
```
On CI/CD platforms like GitHub Actions, this does a from-scratch build of `worker-build` with no caching, which takes 4+ minutes for me on a vanilla `ubuntu-latest` GHA runner. It's also breakage-prone, since `cargo install` without an explicit `--locked` will ignore `worker-build`'s `Cargo.lock` and will attempt re-resolution away from a known-working resolved set.
(This is on top of any build time from the worker's own `cargo build`. But at least for my workers, that tends to be a much smaller/faster build than `worker-build` itself.)
## Proposed solution
I think it would be ideal if Cloudflare could provide pre-builds of `worker-build`, at least for common platforms (Linux AMD64/AArch64, at a minimum?). This would save downstreams a decent amount of time (and compute cost) when deploying Rust-based Workers.
## Workarounds
I can currently work around this by manually running `cargo install --locked cargo-build^0.8` as a pre-step (and enabling appropriate caching in GHA separately). It would be nice if this was more integrated into the `wrangler` flow, however.
Contributor guide
Research direction
Start by tracing how the official Rust worker template installs worker-build and where the wrangler flow could consume a pre-built binary. Compare the current cargo install workaround with the requested Linux AMD64/AArch64 targets; done means documented, reliable pre-built binaries are available and integrated for common deployment environments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, rust
- Domain
- build-system, ci-cd
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100