build tools for docker images
Project description
# FBAD
FBAD is a commandline tool for projects requiring multiple docker images.
# Features
- easily build projects with multiple docker images
- build on remote server
- automatically push build images to registry
- select a subset of images to build
- build images in parallel on multiple buildservers
- you can also build all images on each buildserver (useful for different os architectures)
- run command before each image build (useful for generating dockerfiles before the build)
- automatically format tags (e.g. `myproject-{arch}` -> `myproject-x86`)
- show build output live
- ...
# Recommended directory structure
```
myproject/
imagea/
DOCKERFILE
...
imageb/
DOCKERFILE
...
...
project.py
```
# Example `project.py`
```python
"""example fbad build file"""
from fbad import Project, Image
# the project contains all project and image data
project = Project(
# name of the project
name="Project",
# list of images of the project
images=[
# most simple form
# build the dockerfile in 'cachserver/'
# use 'cachserver/Dockerfile' as dockerfile
# build cwd is 'cachserver/'
# name and tag are 'cachserver'
Image(
path="cacheserver/",
),
# build image from the directory which contains 'project.py'
# everything like above, but cwd is different
# this is useful if you have shared files, like a package for common functionality
# please note that all files being contained in the buildpath will be send to the buildserver.
Image(
path="webserver/",
buildpath="",
),
# build image with auto-formated tag and auto-generated dockerfile
# the tag will be formated on the buildserver (e.g. 'worker-x86')
# the dockerfile will also be generated on the buildserver
# this is useful for building architecture specific images or
# images with architecture-specific dependencies
# this example also uses a custom buildpath
Image(
path="worker/",
tag="worker-{arch}",
buildpath="",
preexec_command=["/usr/bin/python", "worker/generate_dockerfile.py"],
),
# build image with a dockerfile having a different name.
# dockerfile will be 'db/dbdockerfile.txt'
Image(
path="db/",
dockerfile="dbdockerfile.txt",
),
],
)
if __name__ == "__main__":
# run the cli
project.main()
```
# Buildserver
A buildserver is available using the `fbad-server` command.
You can also access import the buildserver as `fbad.server.FBADServerFactory`.
If no custom buildserver is specified when building a project, another buildserver is temporarly started.
# Installation
**Requirements**
FBAD requires python2 (most implementations should work) and twisted.
The buildserver also requires docker to be installed.
**Install via pip**
1. `pip install fbad`
2. Done
**Install from source**
1. `git clone https://github.com/bennr01/fbad.git`
2. `cd fbad`
3. `python setup.py install` (`sudo` may be required, depending on your python configuration)
4. Done.
FBAD is a commandline tool for projects requiring multiple docker images.
# Features
- easily build projects with multiple docker images
- build on remote server
- automatically push build images to registry
- select a subset of images to build
- build images in parallel on multiple buildservers
- you can also build all images on each buildserver (useful for different os architectures)
- run command before each image build (useful for generating dockerfiles before the build)
- automatically format tags (e.g. `myproject-{arch}` -> `myproject-x86`)
- show build output live
- ...
# Recommended directory structure
```
myproject/
imagea/
DOCKERFILE
...
imageb/
DOCKERFILE
...
...
project.py
```
# Example `project.py`
```python
"""example fbad build file"""
from fbad import Project, Image
# the project contains all project and image data
project = Project(
# name of the project
name="Project",
# list of images of the project
images=[
# most simple form
# build the dockerfile in 'cachserver/'
# use 'cachserver/Dockerfile' as dockerfile
# build cwd is 'cachserver/'
# name and tag are 'cachserver'
Image(
path="cacheserver/",
),
# build image from the directory which contains 'project.py'
# everything like above, but cwd is different
# this is useful if you have shared files, like a package for common functionality
# please note that all files being contained in the buildpath will be send to the buildserver.
Image(
path="webserver/",
buildpath="",
),
# build image with auto-formated tag and auto-generated dockerfile
# the tag will be formated on the buildserver (e.g. 'worker-x86')
# the dockerfile will also be generated on the buildserver
# this is useful for building architecture specific images or
# images with architecture-specific dependencies
# this example also uses a custom buildpath
Image(
path="worker/",
tag="worker-{arch}",
buildpath="",
preexec_command=["/usr/bin/python", "worker/generate_dockerfile.py"],
),
# build image with a dockerfile having a different name.
# dockerfile will be 'db/dbdockerfile.txt'
Image(
path="db/",
dockerfile="dbdockerfile.txt",
),
],
)
if __name__ == "__main__":
# run the cli
project.main()
```
# Buildserver
A buildserver is available using the `fbad-server` command.
You can also access import the buildserver as `fbad.server.FBADServerFactory`.
If no custom buildserver is specified when building a project, another buildserver is temporarly started.
# Installation
**Requirements**
FBAD requires python2 (most implementations should work) and twisted.
The buildserver also requires docker to be installed.
**Install via pip**
1. `pip install fbad`
2. Done
**Install from source**
1. `git clone https://github.com/bennr01/fbad.git`
2. `cd fbad`
3. `python setup.py install` (`sudo` may be required, depending on your python configuration)
4. Done.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fbad-0.1.4.tar.gz
(12.7 kB
view details)
Built Distribution
fbad-0.1.4-py2-none-any.whl
(17.6 kB
view details)
File details
Details for the file fbad-0.1.4.tar.gz
.
File metadata
- Download URL: fbad-0.1.4.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3350e390cac969deee880f65753841a189613b4c857ed5245ffa97febf05da13 |
|
MD5 | a6a81f719d6162b2ad23a442bc4c5c88 |
|
BLAKE2b-256 | 63b8566f1bbb100412c2a0e28c2447553bd13bd1965bebb1e080e9c5d16d7e33 |
File details
Details for the file fbad-0.1.4-py2-none-any.whl
.
File metadata
- Download URL: fbad-0.1.4-py2-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fd710ced08605df2348e46b38a43993b342cf343a47e21da5725338c6346953 |
|
MD5 | 31acfe2474bc6adfa4d898742ef4ed5f |
|
BLAKE2b-256 | f9f2e43e8b8b2f33d0fda8a51d88b44ba00252a1cac8d04f5c59b5aa0020e519 |