Closed
Description
I know this issue has been raised already a couple of times (#16, #36, even by me). But with latest stable 1.31 release and 2018 edition landing, the clippy
and rustfmt
components are part of stable toolchain (so no versions mess). Maybe they worth to be included into rust
image by default as are widely used in comparing to other rustup components?
The current situation with CI is relatively OK:
fmt:rust:
stage: test
dependencies: []
image: rust:1.31
services: []
before_script:
- rustup component add rustfmt
script:
- cargo fmt --check
But is trickier when it comes to CLI Docker usage:
docker run --rm -v "$(pwd)":/app -w /app rust:1.31 cargo fmt
error: 'cargo-fmt' is not installed for the toolchain '1.31.0-x86_64-unknown-linux-gnu'
To install, run `rustup component add rustfmt`
Having them baked into the image already will make its usage smoother for almost any project.
Activity
sfackler commentedon Dec 7, 2018
This seems like a decision that should be made in rustup rather than the docker image.
Stargateur commentedon Feb 18, 2020
@sfackler rustup seem to say that it's not their business, rust-lang/rustup#1569 (comment) is their any reason now to not include it now ?
Could we have a rust:tools or something ?
mleonhard commentedon Oct 29, 2020
Can we please re-open and reconsider this?
The instrumentisto/rust images have clippy and rustfmt.
Related: "Include rustfmt and clippy" rust-lang/docker-rust-nightly#25
strct commentedon Jan 11, 2022
There is an unofficial docker image for latest rust including
cargo fmt
andcargo clippy
: https://hub.docker.com/r/rustdocker/rust (It's not mine, but may be valuable for others searching a solution). Gitlab repository here: https://gitlab.com/imp/rustdocker/blob/master/rust/Dockerfileabonander commentedon Feb 1, 2022
rustdocker/rust unfortunately looks like it hasn't been kept up to date.
I would really suggest at least providing another tag with Clippy and rustfmt installed, because when using the image in CI you're gonna end up installing them anyway.
strct commentedon Feb 1, 2022
I do agree that it would be really great if rustfmt and clippy would be added to the official docker image, or a separate official docker image with clippy and rustfmt would be added (at least for stable rust in my use case).
rustdocker/rust doesn't add newer tags to docker.io, but it is on the latest rust version:
not sure why
rustdocker/rust
is trying torustup update
when running the container though.Stargateur commentedon Feb 2, 2022
I personally stop waiting and use the image of our beloved master shep, https://hub.docker.com/u/shepmaster (contains nice image and updated daily). Since shep is a trusted and old Rust contributor it's enough secure for me.
Thus I still push for an official one.
strct commentedon Feb 2, 2022
Thanks for the link. I didn't know about this docker image. I'll start using them too. But I would still appreciate it if
rustfmt
andclippy
were included in the official rust docker image.mleonhard commentedon Feb 8, 2022
I still need this. Please re-open?
vaelund commentedon Feb 23, 2022
I second this. Please reconsider.
Is there any good argument against this, apart from increasing the image size?
--profile minimal
for CI (or add CI tools to the minimal profile) rust-lang/rustup#3078workingjubilee commentedon Mar 10, 2023
Hello from Rustup-land. I come bearing the current apparent consensus from Rustup.
We're thinking about weakening the recommendation for using the "minimal" profile in CI and explaining why we recommended it in the first place in our docs, but also explaining why we don't think the default profile is appropriate for CI.
Namely, the "default" profile includes, according to
du
... apparently over 600 megabytes of documentation? Damn. You most definitely do not need that in a Docker image! The machine is not going to reference the documentation while running tests.At the same time: the minimal profile really is intended to be, well, minimal, and it's really, really hard to say what should go in a hypothetical "ci" profile. The recommendation of "use minimal for CI" was written at a time that rustfmt and clippy did not have the same level of adoption they have acquired, and the most common usecase for the toolchain in CI was simply building code and running tests, and it made sense.
We think that if there's a desire to have a more useful Docker image with selected additional tools, that it should simply be done. It does not need Rustup's blessing, nor do we want to be responsible for deciding what the most maximally useful "Docker image blessed by Rust" is. Rustup is a tool that is designed to allow you to add and remove other parts of the toolchain as you see fit, by design. Please use that feature! We are more likely to have a better idea of what should go into a hypothetical "ci" or perhaps "tools" profile if other parts of the Rust project do feel free to add on to what the existing minimal and default profiles come with.
Don't use the complete profile, though. It's bad!
vaelund commentedon Mar 14, 2023
It appears the following PR would solve this issue: #122
Can I motivate anyone to review that?