All Projects → wemake-services → docker-image-size-limit

wemake-services / docker-image-size-limit

Licence: MIT license
🐳 Keep an eye on your docker image size and prevent it from growing too big

Programming Languages

python
139335 projects - #7 most used programming language
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to docker-image-size-limit

memcheck-cover
An HTML generator for Valgrind's Memcheck tool
Stars: ✭ 30 (-70.59%)
Mutual labels:  code-quality
dockerfiles
Repository for my public Docker images.
Stars: ✭ 22 (-78.43%)
Mutual labels:  docker-images
java-quality-checks
No description or website provided.
Stars: ✭ 33 (-67.65%)
Mutual labels:  code-quality
javascript-test-reporter
DEPRECATED Code Climate test reporter client for JavaScript projects
Stars: ✭ 68 (-33.33%)
Mutual labels:  code-quality
dockerfiles
A collection of Dockerfiles
Stars: ✭ 103 (+0.98%)
Mutual labels:  docker-images
phpcs-gitlab
Gitlab Report for PHP_CodeSniffer (display the violations in the Gitlab CI/CD Code Quality Report)
Stars: ✭ 29 (-71.57%)
Mutual labels:  code-quality
Vim Fibo Indent
Fibonacci Indentation for Vim.
Stars: ✭ 244 (+139.22%)
Mutual labels:  code-quality
ctfhub base image
Index of CTFHub Base Images
Stars: ✭ 70 (-31.37%)
Mutual labels:  docker-images
discolix
distroless arm docker images
Stars: ✭ 22 (-78.43%)
Mutual labels:  docker-images
Zilon Roguelike
Survival roguelike game with huge world generation.
Stars: ✭ 18 (-82.35%)
Mutual labels:  code-quality
superhelp
Python help that really helps
Stars: ✭ 27 (-73.53%)
Mutual labels:  code-quality
docker-credential-magic
A magic shim for Docker credential helpers 🪄
Stars: ✭ 56 (-45.1%)
Mutual labels:  docker-images
code-assert
Assert that the java code of a project satisfies certain checks.
Stars: ✭ 94 (-7.84%)
Mutual labels:  code-quality
effective-code-review
Presentation about my process for making code reviews as effective as possible
Stars: ✭ 63 (-38.24%)
Mutual labels:  code-quality
docker-manpages-osx
the missing man pages for Docker on Mac OS X
Stars: ✭ 16 (-84.31%)
Mutual labels:  docker-images
Interrogate
Explain yourself! Interrogate a codebase for docstring coverage.
Stars: ✭ 245 (+140.2%)
Mutual labels:  code-quality
localhost-sonarqube
Analysing source code locally with SonarQube in a Docker environment.
Stars: ✭ 17 (-83.33%)
Mutual labels:  code-quality
Imgbot
An Azure Function solution to crawl through all of your image files in GitHub and losslessly compress them. This will make the file size go down, but leave the dimensions and quality untouched. Once it's done, ImgBot will open a pull request for you to review and merge. [email protected]
Stars: ✭ 1,017 (+897.06%)
Mutual labels:  code-quality
binance-node-docker
Docker image for Binance full and light nodes
Stars: ✭ 24 (-76.47%)
Mutual labels:  docker-images
inline-plz
Inline your lint messages
Stars: ✭ 32 (-68.63%)
Mutual labels:  code-quality

docker-image-size-limit

wemake.services Build status codecov Python Version wemake-python-styleguide

Limit your docker image size with a simple CLI command. Perfect to be used inside your CI process.

Read the announcing post.

Installation

pip install docker-image-size-limit

Or use our Github Action or pre-built docker image.

Usage

We support just a single command:

$ disl your-image-name:label 300MiB
your-image-name:label exceeds 300MiB limit by 114.4 MiB

Options

You can specify your image as:

  • Image name: python
  • Image name with tag: python:3.6.6-alpine

You can specify your size as:

  • Raw number of bytes: 1024
  • Human-readable megabytes: 30 MB or 30 MiB
  • Human-readable gigabytes: 1 GB or 1 GiB
  • Any other size supported by humanfriendly

Programmatic usage

You can also import and use this library as python code:

from docker import from_env
from docker_image_size_limit import check_image_size

oversize = check_image_size(from_env(), 'image-name:latest', '1 GiB')
assert oversize < 0, 'Too big image!'  # negative oversize - is a good thing!

We also ship PEP-561 compatible type annotations with this library.

Github Action

You can also use this check as a Gihub Action:

- uses: wemake-services/docker-image-size-limit@master
  with:
    image: "$YOUR_IMAGE_NAME"
    size: "$YOUR_SIZE_LIMIT"

Here's an example.

Docker Image

We have a pre-built image available.

First, pull our pre-built docker image:

docker pull wemakeservices/docker-image-size-limit

Then you can use it like so:

docker run -v /var/run/docker.sock:/var/run/docker.sock --rm \
  -e INPUT_IMAGE="$YOUR_IMAGE_NAME" \
  -e INPUT_SIZE="$YOUR_SIZE_LIMIT" \
  wemakeservices/docker-image-size-limit

Should I use it?

You can use this script instead:

LIMIT=1024  # adjust at your will
IMAGE='your-image-name:latest'

SIZE="$(docker image inspect "$IMAGE" --format='{{.Size}}')"
test "$SIZE" -gt "$LIMIT" && echo 'Limit exceeded'; exit 1 || echo 'Ok!'

But I prefer to reuse tools over custom bash scripts here and there.

License

MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].