Show HN: Dockershrink – AI Assistant to reduce the size of Docker images https://ift.tt/vpyHXUe

Show HN: Dockershrink – AI Assistant to reduce the size of Docker images https://ift.tt/vpyHXUe

Show HN: Dockershrink – AI Assistant to reduce the size of Docker images For the past few months, I've been hacking around a project I call Dockershrink. It automates a simple task: Take a Dockerfile and optimize its code with the goal of reducing the size of the final Docker image. People don't realize that we can apply some very basic techniques to reduce, for eg, a 2GB image down to just ~100MB: - Multistage builds with light-weight base image for final stage - Remove unused dependencies - Optimizations specific to the tech stack And I feel like I've already done this optimization for my personal projects and backend apps at my job(s) a couple of times. The project currently uses GPT-4o (open source so you can run it locally) and only works for Nodejs projects. There are a couple of reasons why I think dockershrink can be better than using just Vanilla LLM or Github Copilot/Cursor: - Image optimization can benefit from a lot of custom prompting, especially when you have insights about specific tech stacks. Describing techniques deeply in the prompt gave better results than simply asking the LLM to "optimize code for bloat reduction". - A RAG approach will be truly beneficial. I plan on giving dockershrink access to up-to-date documentations of Docker, Bash and all programming languages out there. Additionally, it can be given a few suitable chunks of code to enhance the context. - Analysing custom base images: most orgs have their customized base images. Adding context about these can further help Dockershrink make better decisions. Try it out - "brew install dockershrink" Happy to hear your thoughts! https://ift.tt/VjRiBmp February 14, 2025 at 04:15AM

0 Comments: