Dbp
build multiple images with dependencies with other images.
A multi-build is detect by change of a commit.
Dbp
generate also a document with data specified in each directory.
Dbp
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/
Dbp
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
,
Dbp
will build all images in this order :
1. `debian`
2. `debian-ngix`
3. `debian-nginx-php`
Dbp
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 : insanebrain/dbp:v1.0.0
## Parents
- [insanebrain/alpine:v1.0.0](../../alpine/v1.0.0/README.md)
- [alpine:3.9](https://hub.docker.com/_/alpine)
## Children
- [insanebrain/dbp:v1.0.0-dev](../../dbp/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 DBP v1.1.0 / February 07, 2019 12:44:17
This file will be generate with data your set in dbp.yml. This file is also used for build image.
So, if you want use Dbp
you must add this file for all of your images like this :
.
├── debian
│ └── v1
│ │── Dockerfile
│ │── dbp.yml
│ └── bin
├── apline
│ └── v1
│ │── Dockerfile
│ │── dbp.yml
│ └── config/
│── debian-nginx
│ └── v1
│ │── Dockerfile
│ │── dbp.yml
│ └── config/
└── debian-nginx-php
└── v1
│── Dockerfile
│── dbp.yml
└── php/
Dbp
can be configured to set log level or change default template used for README.md image.
For configure Dbp
add config.yml at the root of dir.
Currently, you can configure this parameters :
log:
levelStdout: "info" # trace / debug / info / warn / error / fatal / panic
pathFile: "dbp.log"
levelFile: "info" # trace / debug / info / warn / error / fatal / panic
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
dbp --help
usage: dbp [<flags>] <command> [<args> ...]
A command-line dbp helper.
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-c, --config=CONFIG Define specific configuration file
-p, --path="." Define execution path
Commands:
help [<command>...]
Show help.
build dirty
Build docker images for dirty repo
build commit <commit>
Build docker images for specific commit
list
List all images of directory
generate dirty
Generate readme of images for dirty repo
generate commit <commit>
Generate readme of images for specific commit
generate all
Generate readme of images for all
generate index
Generate a readme index
version
Display version
- Docker (18.06+)
- Git (2.17+)
-
Install go-bindata:
go get -u github.com/go-bindata/go-bindata/...
-
Generate assets:
go generate
-
Build the project:
go build .
-
Run tests:
go test ./...
-
Run dbp with docker:
docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}:/build insanebrain/dbp:${VERSION} dbp --help
-
Install dbp with deb (may require sudo privileges):
curl -L "https://github.com/insanebrain/dbp/releases/download/${VERSION}/dbp_$(uname -m).deb" -o dbp_$(uname -m).deb dpkg -i dbp_$(uname -m).deb rm dbp_$(uname -m).deb
-
Install binary to custom location:
curl -L "https://github.com/insanebrain/dbp/releases/download/${VERSION}/dbp_$(uname -s)_$(uname -m)" -o ${DESTINATION}/dbp chmod +x ${DESTINATION}/dbp
See documentation example for image configuration here.
See documentation example for dbp configuration here.
Add in your ~/.bashrc :
eval "$(dbp --completion-script-bash)"
Add in your ~/.zshrc :
eval "$(dbp --completion-script-zsh)"
Refer to CONTRIBUTING.md
MIT License, see LICENSE.