{"id":22426363,"url":"https://github.com/duaraghav8/dockershrink","last_synced_at":"2025-05-15T10:03:16.355Z","repository":{"id":266488302,"uuid":"855091786","full_name":"duaraghav8/dockershrink","owner":"duaraghav8","description":"Dockershrink is an AI Assistant that reduces the size of your application's Docker Image","archived":false,"fork":false,"pushed_at":"2025-01-26T17:54:39.000Z","size":12395,"stargazers_count":402,"open_issues_count":24,"forks_count":55,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-11T12:00:01.647Z","etag":null,"topics":["ai","ai-agent","containers","docker","optimization","retrieval-augmented-generation"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/duaraghav8.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["duaraghav8"]}},"created_at":"2024-09-10T09:41:49.000Z","updated_at":"2025-05-08T08:14:21.000Z","dependencies_parsed_at":"2024-12-19T21:18:31.184Z","dependency_job_id":"b16e4cd8-2c03-46b8-b414-91d17800d4a6","html_url":"https://github.com/duaraghav8/dockershrink","commit_stats":{"total_commits":200,"total_committers":2,"mean_commits":100.0,"dds":"0.010000000000000009","last_synced_commit":"936a924929edf3c1b08cddbb831bdd0b7459c6d8"},"previous_names":["duaraghav8/dockershrink"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duaraghav8%2Fdockershrink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duaraghav8%2Fdockershrink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duaraghav8%2Fdockershrink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duaraghav8%2Fdockershrink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duaraghav8","download_url":"https://codeload.github.com/duaraghav8/dockershrink/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253561115,"owners_count":21927764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-agent","containers","docker","optimization","retrieval-augmented-generation"],"created_at":"2024-12-05T19:17:58.529Z","updated_at":"2025-05-15T10:03:08.899Z","avatar_url":"https://github.com/duaraghav8.png","language":"Go","funding_links":["https://github.com/sponsors/duaraghav8"],"categories":["Go"],"sub_categories":[],"readme":"# DockerShrink\n\n[![](https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86)](https://github.com/sponsors/duaraghav8)\n\n[Talk to us on Slack](https://join.slack.com/t/dockershrink/shared_invite/zt-2vwkeqw0k-JXmHBNCQnG4X1BBf1t3xyg) **|** [Vote for Feature Requests](https://github.com/duaraghav8/dockershrink/issues?q=is%3Aopen+is%3Aissue+label%3Afeature-request)\n\n---\n\nDockershrink is an AI-powered Commandline Tool that helps you reduce the size of your Docker images\n\n\n![Typical interaction with dockershrink CLI](./assets/images/dockershrink-how-it-works.gif)\n\nIt combines the power of algorithmic analysis with Generative AI to apply state-of-the-art optimizations to your Image configurations :brain:\n\nDockershrink can automatically apply techniques like Multi-Stage builds, switching to Lighter base images like alpine and running dependency checks. PLUS a lot more is on the roadmap :rocket:\n\nCurrently, the tool only supports [NodeJS](https://nodejs.org/en) applications.\n\nIt can:\n1. **Generate** optimized Docker image defintions (Dockerfile and .dockerignore) for new projects\n2. **Optimize** existing image definition by including best practices to avoid bloat\n\n\n\u003e [!IMPORTANT]\n\u003e Dockershrink is **BETA** software.\n\u003e \n\u003e You can provide your feedback by [creating an Issue](https://github.com/duaraghav8/dockershrink/issues) in this repository.\n\n\n## Why does dockershrink exist?\nEvery org using containers in development or production environments understands the pain of managing hundreds or even thousands of bloated Docker images in their infrastructure.\n\nHigh data storage and transfer costs, long build times, underprodctive developers - we've seen it all.\n\nThe issue becomes even more painful and costly with interpreted languages such as Nodejs \u0026 Python.\nApps written in these languages need to pack the interpreters and all their dependencies inside their container images, significantly increasing their size.\n\nBut not everyone realizes that by just implementing some basic techniques, they can reduce the size of a 1GB Docker image down to **as little as 100 MB**!\n\n([I also made a video on how to do this.](https://youtu.be/vHBHxQfK6cM))\n\nImagine the costs saved in storage \u0026 data transfer, decrease in build times AND the productivity gains for developers :exploding_head:\n\nDockershrink aims to automatically apply advanced optimization techniques so engineers don't have to waste time on it and the organization still saves :moneybag:!\n\nYou're welcome :wink:\n\n\n## Installation\nDockershrink is shipped as a stand-alone binary.\n\nYou can either download it from the [Releases](https://github.com/duaraghav8/dockershrink/releases) Page or use [Homebrew](https://brew.sh/) to install it:\n\n```bash\n$ brew install duaraghav8/tap/dockershrink\n```\n\n\u003e [!IMPORTANT]\n\u003e On MacOS, you will have to use homebrew because the compiled binary is not [Notarized](https://developer.apple.com/documentation/security/notarizing-macos-software-before-distribution).\n\n## Usage\n\nNavigate into the root directory of your Node.js project and invoke dockershrink:\n\n```bash\n# To optimize existing Docker-related files\n$ dockershrink optimize\n\n# To generate new Docker files\n$ export OPENAI_API_KEY=...\n$ dockershrink generate\n```\n\nDockershrink creates a new directory which contains the files produced by it.\nBy default, this directory is `dockershrink.out`.\n\nFor detailed information about a command, run\n\n```bash\n$ dockershrink help optimize\n$ dockershrink help generate\n```\n\nYou can also use the `--debug` option to get DEBUG logs. These are especially helpful during troubleshooting.\n\n```bash\n$ dockershrink generate --debug\n```\n\n### Using AI Features\n\n\u003e [!NOTE]\n\u003e Using AI features is optional for \"optimize\" (but highly recommended) and mandatory for \"generate\".\n\n\nIf you want to enable AI, you must supply your [OpenAI API Key](https://openai.com/index/openai-api/).\n\nSo even though Dockershrink itself is free, openai usage might incur some cost for you.\n\n```bash\ndockershrink optimize --openai-api-key \u003cyour openai api key\u003e\n\n# Alternatively, you can supply the key as an environment variable\nexport OPENAI_API_KEY=\u003cyour openai api key\u003e\ndockershrink generate\n```\n\n\u003e [!NOTE]\n\u003e Dockershrink does not store your OpenAI API Key.\n\u003e\n\u003e So you must provide your key every time you want Dockershrink to use it.\n\u003e This is to avoid any unexpected costs.\n\n---\n\n## Development :computer:\n\u003e [!NOTE]\n\u003e This section is for authors and contributors.\n\u003e If you're simply interested in using Dockershrink, you can skip it.\n\n\n### Prerequisites\n\n- Clone this repository on to your local machine.\n- Make sure [Golang](https://golang.org/dl/) is installed on your system (at least version 1.23)\n- Make sure [Docker](https://www.docker.com/get-started) installed on your system and the Docker daemon is running.\n- Install [GoReleaser](https://goreleaser.com/) (at least version 2.4)\n\n### Development\n1. After cloning this repository, navigate inside the root directory of the project\n2. Run tests to ensure everything is working\n```bash\ngo test ./...\n```\n3. Make your code changes, add relevant tests.\n4. Tidy up and make sure all tests pass\n```bash\ngo mod tidy\ngo mod vendor\ngo test ./...\n```\n\n### Build for local testing\n```bash\n# Single binary\ngoreleaser build --single-target --clean --snapshot\n\n# All binaries\ngoreleaser release --snapshot --clean\n```\n\n### Create a new release\n1. Create a Git Tag with the new version\n\n```bash\ngit tag -a v0.1.0 -m \"Release version 0.1.0\"\ngit push origin v0.1.0\n```\n\n2. Release\n```bash\n# Make sure GPG is present on your system and you have a default key which is added to Github.\n\n# set your github access token\nexport GITHUB_TOKEN=\"\u003cyour GH token\u003e\"\n\ngoreleaser release --clean\n```\n\nThis will create a new release under Releases and also make it available via Homebrew.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduaraghav8%2Fdockershrink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduaraghav8%2Fdockershrink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduaraghav8%2Fdockershrink/lists"}