|
|
|
@ -4,7 +4,9 @@ from ..infrastructure import FileApi, ResourceApi, ImageApi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ImageBuildService:
|
|
|
|
|
def __init__(self, file_api: FileApi, resource_api: ResourceApi, image_api: ImageApi):
|
|
|
|
|
def __init__(
|
|
|
|
|
self, file_api: FileApi, resource_api: ResourceApi, image_api: ImageApi
|
|
|
|
|
):
|
|
|
|
|
self.file_api = file_api
|
|
|
|
|
self.resource_api = resource_api
|
|
|
|
|
self.image_api = image_api
|
|
|
|
@ -18,7 +20,9 @@ class ImageBuildService:
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def __copy_build_resource_file_from_package__(self, resource_name, devops: Devops):
|
|
|
|
|
data = self.resource_api.read_resource(f"src/main/resources/docker/{resource_name}")
|
|
|
|
|
data = self.resource_api.read_resource(
|
|
|
|
|
f"src/main/resources/docker/{resource_name}"
|
|
|
|
|
)
|
|
|
|
|
self.file_api.write_data_to_file(
|
|
|
|
|
Path(f"{devops.build_path()}/{resource_name}"), data
|
|
|
|
|
)
|
|
|
|
@ -30,9 +34,7 @@ class ImageBuildService:
|
|
|
|
|
|
|
|
|
|
def __copy_build_resources_from_dir__(self, devops: Devops):
|
|
|
|
|
image = devops.specialized_builds[BuildType.IMAGE]
|
|
|
|
|
self.file_api.cp_force(
|
|
|
|
|
image.build_commons_path(), devops.build_path()
|
|
|
|
|
)
|
|
|
|
|
self.file_api.cp_force(image.build_commons_path(), devops.build_path())
|
|
|
|
|
|
|
|
|
|
def initialize_build_dir(self, devops: Devops):
|
|
|
|
|
image = devops.specialized_builds[BuildType.IMAGE]
|
|
|
|
@ -61,8 +63,12 @@ class ImageBuildService:
|
|
|
|
|
|
|
|
|
|
def dockerhub_publish(self, devops: Devops):
|
|
|
|
|
image = devops.specialized_builds[BuildType.IMAGE]
|
|
|
|
|
if image.image_tag is not None:
|
|
|
|
|
self.image_api.dockerhub_publish(
|
|
|
|
|
image.image_name(), image.image_dockerhub_user, image.image_tag
|
|
|
|
|
)
|
|
|
|
|
self.image_api.dockerhub_publish(
|
|
|
|
|
image.image_name(), image.image_dockerhub_user, image.image_tag
|
|
|
|
|
image.image_name(), image.image_dockerhub_user, 'latest'
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def test(self, devops: Devops):
|
|
|
|
|