measuredockerbuild
v0.0.3
Published
a simple cli to measure docker build steps durations
Downloads
14
Readme
Measure Docker Build durations
Sometimes docker builds can take forever. That can be annoying especially when you have to rebuild the image mutliple times. But docker offers a great solution to minimize the build time -> CACHING.
To optimize your builds it can help that you know which steps need a lot of time. This simple cli measures the duration of each step and returns a nice table/json containing the data at the end.
It's as simple as
$ npx measuredockerbuild table <docker build args>
# e.g. npx measuredockerbuild table -t test . --no-cache
#
# ...
#
# START BUILD | 249 ms
# ------------------------------------------------------------------
# Step 1/5 : FROM docker:latest | 0 ms
# ------------------------------------------------------------------
# Step 2/5 : RUN apk add --no-cache nodejs npm | 5608 ms
# ------------------------------------------------------------------
# Step 3/5 : RUN npm i -g measuredockerbuild | 3859 ms
# ------------------------------------------------------------------
# Step 4/5 : ENTRYPOINT [ "measuredockerbuild" ] | 96 ms
# ------------------------------------------------------------------
# Step 5/5 : CMD ["table", "."] | 108 ms
# ------------------------------------------------------------------
# END BUILD | 9920 ms Installation
You can install it globally or locally or use npx. I recommend the global installation.
I test the cli on mac/linux
global installation
$ npm i -g measuredockerbuildper project installation
$ npm i measuredockerbuildno installation
$ npx measuredockerbuild ...Usage
It's very simple, just choose the output format and then provide all arguments you would normally pass to docker build.
$ measuredockerbuild <json|table> <docker build args>get all docker build arguments with
$ docker build --helpUsage without nodejs
You can use the tool, even when only docker is installed with the following image: milleniumfrog/measuredockerbuild:latest.
The image is a drop in replacement for the docker:latest but can use measuredockerbuild.
Mount /var/run/docker.sock, then you can build dockerimages inside a container.
$ docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/folder milleniumfrog/measuredockerbuild:latest measuredockerbuild table -t example /folderAdditional
- Feel free to open an issue if you have problems Link to issues
