mib
build multiple images with dependencies with other images.
A multi-build is detect by change of a commit.
mib
generate also a document with data specified in each directory.
mib
is very useful when you store all you Dockerfile in the same folder like this :
.
├── debian
│ └── v1
│ │── Dockerfile
│ └── bin
├── apline
│ └── v1
│ │── Dockerfile
│ └── config/
│── debian-nginx
│ └── v1
│ │── Dockerfile
│ └── config/
└── debian-nginx-php
└── v1
│── Dockerfile
└── php/
Or
.
├── debian
│ │── Dockerfile
│ └── bin
├── apline
│ │── Dockerfile
│ └── config/
│── debian-nginx
│ │── Dockerfile
│ └── config/
└── debian-nginx-php
│── Dockerfile
└── php/
mib
will help you to build image in the good order for build first the image parent and after children.
For example, if the image debian
is parent of debian-ngix
and debian-nginx
is parent of debian-nginx-php
,
mib
will build all images in this order :
1. `debian`
2. `debian-ngix`
3. `debian-nginx-php`
mib
works with two modes :
build dirty
: get all files modified in repository (like git status), and will exclude ".md" and ".txt" extensions file and determine dependency between imagebuild commit [commit sha]
: get all files modified in commit change in repository, and will exclude ".md" and ".txt" extensions file and determine dependency between image
You can also generate README.md per all images to describe image like this :
# Image : alexandreh2ag/mib:v1.0.0
## Parents
- [alexandreh2ag/alpine:v1.0.0](../../alpine/v1.0.0/README.md)
- [alpine:3.9](https://hub.docker.com/_/alpine)
## Children
- [alexandreh2ag/mib:v1.0.0-dev](../../mib/v1.0.0-dev/README.md)
## Env Var
| Var Name | Value |
| -------- | ----- |
| GID | Host group id (id -g) |
| UID | Host user id (id -u) |
## Packages
| Var Name | Value |
| -------- | ----- |
| ca-certificates |
| curl | |
| vim | |
| wget | |
## Alias
- foo/alpine:v1.0.0
File generated by mib v1.1.0 / February 07, 2019 12:44:17
This file will be generate with data your set in mib.yml. This file is also used for build image.
So, if you want use mib
you must add this file for all of your images like this :
.
├── debian
│ └── v1
│ │── Dockerfile
│ │── mib.yml
│ └── bin
├── apline
│ └── v1
│ │── Dockerfile
│ │── mib.yml
│ └── config/
│── debian-nginx
│ └── v1
│ │── Dockerfile
│ │── mib.yml
│ └── config/
└── debian-nginx-php
└── v1
│── Dockerfile
│── mib.yml
└── php/
mib
can be configured to set log level or change default template used for README.md image.
For configure mib
add config.yml at the root of dir.
Currently, you can configure this parameters :
build:
extensionExclude: ".md,.txt" #default extension files that will be exclude when run `build` or `generate`
template:
imagePath: "my-custom-image.tmpl" # Define a custom template for image
indexPath: "my-custom-index.tmpl" # Define a custom template for index
Usage:
mib [command]
Available Commands:
build build sub commands
commit Build image for specific commit
dirty Build image with change not committed
commit Commit all changes
completion Generate the autocompletion script for the specified shell
generate generate sub commands
all Generate all images readme
dirty Generate image readme with change not committed
index Generate index readme
help Help about any command
list List all images of directory
version Show version info
Flags:
-c, --config string Define config path
-w, --dir string Define working dir (default "/home/alexandre/projects/labs/mib")
-h, --help help for mib
-l, --level string Define log level (default "INFO")
- Docker (26.0+)
- Git (2.25+)
sudo apt install -y qemu-user-static binfmt-support
For build an image for a different platform or multiples platform you must enable feature containerd-snapshotter.
-
Generate mock:
./bin/mock.sh
-
Build the project:
go build .
-
Run tests:
go test ./...
-
Run mib with docker:
docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}:/build alexandreh2ag/mib:${VERSION} mib --help
-
Install binary to custom location:
curl -L "https://github.com/alexandreh2ag/mib/releases/download/${VERSION}/mib_$(uname -s)_$(uname -m)" -o ${DESTINATION}/mib chmod +x ${DESTINATION}/mib
See documentation example for image configuration here.
See documentation example for mib configuration here.
Add in your ~/.bashrc :
eval "$(mib --completion-script-bash)"
Add in your ~/.zshrc :
eval "$(mib --completion-script-zsh)"
Refer to CONTRIBUTING.md
MIT License, see LICENSE.