c4k-nextcloud/infrastructure/docker-backup/build.py

50 lines
1.2 KiB
Python
Raw Normal View History

2021-08-06 15:36:59 +00:00
from os import environ
from pybuilder.core import task, init
from ddadevops import *
import logging
2021-09-14 16:24:52 +00:00
name = 'c4k-cloud-backup'
2021-08-06 15:36:59 +00:00
MODULE = 'docker'
PROJECT_ROOT_PATH = '../..'
2021-08-06 15:36:59 +00:00
class MyBuild(DevopsDockerBuild):
pass
@init
def initialize(project):
2021-09-10 14:55:39 +00:00
project.build_depends_on('ddadevops>=0.12.4')
stage = 'notused'
2021-08-06 15:36:59 +00:00
dockerhub_user = environ.get('DOCKERHUB_USER')
if not dockerhub_user:
dockerhub_user = gopass_field_from_path('meissa/web/docker.com', 'login')
dockerhub_password = environ.get('DOCKERHUB_PASSWORD')
if not dockerhub_password:
dockerhub_password = gopass_password_from_path('meissa/web/docker.com')
config = create_devops_docker_build_config(
stage, PROJECT_ROOT_PATH, MODULE, dockerhub_user, dockerhub_password)
2021-08-06 15:36:59 +00:00
build = MyBuild(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):
2021-08-06 15:36:59 +00:00
build = get_devops_build(project)
build.test()
2021-08-06 15:36:59 +00:00
@task
def publish(project):
2021-08-06 15:36:59 +00:00
build = get_devops_build(project)
build.dockerhub_login()
build.dockerhub_publish()