bnjbvr / cargo-machete

Remove unused Rust dependencies with this one weird trick!
MIT License
722 stars 29 forks source link

Create a docker image? #93

Closed dessalines closed 10 months ago

dessalines commented 10 months ago

It'd be really useful to have an official docker image along with your releases, that we could use in our CI pipeline.

bnjbvr commented 10 months ago

Sure, why not! If there's a way to automate that for free, using Github Actions for publishing the new image, I'm up for it. As I don't know too much how that all works, help would be appreciated.

dessalines commented 10 months ago

I'm not familiar with github CI unfortunately, we use woodpecker CI which is an open source one for all our projects, and it has a docker buildx plugin that can build and push to dockerhub.

I'm sure one probably exists for github tho.

dessalines commented 10 months ago

I've decided for things like this, rather than deploying a full docker image, its probably just easier to use cargo binstall in the CI. Here's some sample CI code:

commands:

- wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
- tar -xvf cargo-binstall-x86_64-unknown-linux-musl.tgz
- cp cargo-binstall /usr/local/cargo/bin
- cargo binstall -y cargo-machete
- cargo machete
bnjbvr commented 10 months ago

Nice! TIL binstall. For what it's worth, one might also take the latest release exe from Github, modify it to make it executable, and then put it in $HOME/.cargo/bin, then run cargo machete.