add image-build doc
This commit is contained in:
parent
33d05cfb94
commit
e495cb1e60
3 changed files with 116 additions and 1 deletions
|
@ -75,6 +75,7 @@ classDiagram
|
|||
DevopsBuild <|-- C4kBuild
|
||||
|
||||
link DevopsBuild "./doc/DevopsBuild.md"
|
||||
link DevopsImageBuild "./doc/DevopsImageBuild.md"
|
||||
|
||||
```
|
||||
|
||||
|
@ -96,6 +97,7 @@ export PATH=$PATH:~/.local/bin
|
|||
## Reference
|
||||
|
||||
* [DevopsBuild](./doc/DevopsBuild.md)
|
||||
* [DevopsImageBuild](./doc/DevopsImageBuild.md)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ def initialize(project):
|
|||
"mixin_types": [],
|
||||
}
|
||||
|
||||
build = DevopsTerraformBuild(project, config)
|
||||
build = DevopsBuild(project, config)
|
||||
build.initialize_build_dir()
|
||||
|
||||
|
||||
|
|
113
doc/DevopsImageBuild.md
Normal file
113
doc/DevopsImageBuild.md
Normal file
|
@ -0,0 +1,113 @@
|
|||
# DevopsImageBuild
|
||||
|
||||
DevopsBuild stellt die build Grundlagen zur Verfügung.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class DevopsImageBuild {
|
||||
initialize_build_dir() - copy current directory & additional files to target
|
||||
image() - build image localy. Sources for image build are expected at ./image
|
||||
drun() - start your localy build image
|
||||
dockerhub_login() - login to dockerhub
|
||||
dockerhub_publish() - publish your image
|
||||
test() - builds a test image. Sources for image test are expected at ./test
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Input
|
||||
|
||||
| name | description | default |
|
||||
| ------------------------ | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
||||
| name | dedicated name of the build - also used as image name | module |
|
||||
| module | module name - may result in a hierarchy like name/module | |
|
||||
| stage | not used in this build | |
|
||||
| project_root_path | relative path to projects root. Is used to locate the target dir | |
|
||||
| build_dir_name | name of dir, build is executed in | target |
|
||||
| build_types | list of special builds used. Value has to be contained["IMAGE"] | [] |
|
||||
| mixin_types | mixins are orthoganl to builds and represent additional capabilities. Valid Values are ["RELEASE"] | [] |
|
||||
| credentials_mappings | values for image_dockerhub_user & image_dockerhub_password can be read from gopass | [defaults](#credentials-mapping-defaults) |
|
||||
| image_dockerhub_user | user to access docker-hub | IMAGE_DOCKERHUB_USER from env or credentials from gopass |
|
||||
| image_dockerhub_password | password to access docker-hub | IMAGE_DOCKERHUB_PASSWORD from env or credentials from gopass |
|
||||
| image_tag | tag for publishing the image | IMAGE_TAG from env |
|
||||
|
||||
|
||||
### Credentials Mapping defaults
|
||||
|
||||
```python
|
||||
[
|
||||
{
|
||||
"gopass_path": "meissa/web/docker.com",
|
||||
"gopass_field": "login",
|
||||
"name": "image_dockerhub_user",
|
||||
},
|
||||
{
|
||||
"gopass_path": "meissa/web/docker.com",
|
||||
"name": "image_dockerhub_password",
|
||||
},
|
||||
]
|
||||
```
|
||||
|
||||
## Example Usage
|
||||
### build.py
|
||||
|
||||
```python
|
||||
from subprocess import run
|
||||
from pybuilder.core import task, init
|
||||
from ddadevops import *
|
||||
|
||||
name = 'my-project'
|
||||
MODULE = 'my-module'
|
||||
PROJECT_ROOT_PATH = '..'
|
||||
|
||||
@init
|
||||
def initialize(project):
|
||||
project.build_depends_on("ddadevops>=4.0.0")
|
||||
|
||||
input = {
|
||||
"name": name,
|
||||
"module": MODULE,
|
||||
"stage": "notused",
|
||||
"project_root_path": PROJECT_ROOT_PATH,
|
||||
"build_types": ["IMAGE"],
|
||||
"mixin_types": [],
|
||||
}
|
||||
|
||||
build = DevopsImageBuild(project, config)
|
||||
build.initialize_build_dir()
|
||||
|
||||
|
||||
@task
|
||||
def image(project):
|
||||
build = get_devops_build(project)
|
||||
build.image()
|
||||
|
||||
|
||||
@task
|
||||
def drun(project):
|
||||
build = get_devops_build(project)
|
||||
build.drun()
|
||||
|
||||
|
||||
@task
|
||||
def test(project):
|
||||
build = get_devops_build(project)
|
||||
build.test()
|
||||
|
||||
|
||||
@task
|
||||
def publish(project):
|
||||
build = get_devops_build(project)
|
||||
build.dockerhub_login()
|
||||
build.dockerhub_publish()
|
||||
```
|
||||
|
||||
### call the build
|
||||
|
||||
```bash
|
||||
pyb image test publish
|
||||
```
|
||||
|
||||
### full example
|
||||
|
||||
... can be found [here](infrastructure/devops-build)
|
Loading…
Reference in a new issue