adamghill / build-docker-and-deploy-to-caprover

MIT License
4 stars 1 forks source link

reduce image size with docker-slim #5

Open Tobi-De opened 7 months ago

Tobi-De commented 7 months ago

could be interesting to build the image using https://github.com/slimtoolkit/slim, on the free tier, there is a limit on the github packages size, smaller images could help here.

adamghill commented 7 months ago

I probably wouldn't dig into it myself, but I'd take a look at a PR for this.

I added a directory deletion at https://github.com/adamghill/fediview/blob/main/.github/workflows/deploy.yml#L17-L18 because I was running into disk space issues (based on https://github.com/orgs/community/discussions/25678). I wonder if it would be helpful here, too?

Tobi-De commented 7 months ago

I probably wouldn't dig into it myself, but I'd take a look at a PR for this.

I will look into issue, my only issue is how to test the action to see if it's working

I added a directory deletion at adamghill/fediview@main/.github/workflows/deploy.yml#L17-L18 because I was running into disk space issues (based on github.com/orgs/community/discussions/25678). I wonder if it would be helpful here, too?

yep could be useful, doesn't hurt to add

Boscop commented 1 month ago

@Tobi-De How much will docker-slim reduce your image size if you've already made it small by using multi-stage builds? https://docs.docker.com/get-started/docker-concepts/building-images/multi-stage-builds/ https://docs.docker.com/build/building/multi-stage/ E.g.: https://github.com/benwis/benwis_leptos/blob/main/Dockerfile Can docker-slim do more size reduction?

EDIT: Apparently yes, I found this interesting article that combines multiple approaches of docker image size reduction: https://semaphoreci.com/blog/reduce-docker-image-size