Brencher docker build cache (#67)
This commit is contained in:
@@ -17,6 +17,7 @@ buildDocker = DockerComposeBuild(clone,
|
||||
docker_compose_path="docker-compose.yml",
|
||||
docker_repo_url="https://registry.rudolf.keenetic.link",
|
||||
publish=False,
|
||||
build_cache = True,
|
||||
envs=lambda: {
|
||||
"version": "auto-" + checkoutMerged.progress().version,
|
||||
"user_group": "1000:137"
|
||||
|
||||
@@ -33,6 +33,7 @@ buildDocker = DockerComposeBuild(clone,
|
||||
docker_compose_path="docker-compose.yml",
|
||||
docker_repo_url="https://registry.rudolf.keenetic.link",
|
||||
publish=False,
|
||||
build_cache = True,
|
||||
envs=lambda: {
|
||||
"version": "auto-" + checkoutMerged.progress().version,
|
||||
"user_group": "1000:137"
|
||||
|
||||
@@ -23,7 +23,9 @@ class DockerComposeBuild(AbstractStep[List[str]]):
|
||||
docker_compose_path: str,
|
||||
docker_repo_url: str,
|
||||
publish: bool,
|
||||
envs: Callable[[], Dict[str, Any]], **kwargs: Any) -> None:
|
||||
envs: Callable[[], Dict[str, Any]],
|
||||
build_cache: bool = False,
|
||||
**kwargs: Any) -> None:
|
||||
super().__init__(**kwargs)
|
||||
self.wd = wd
|
||||
self.envs = envs
|
||||
@@ -32,6 +34,7 @@ class DockerComposeBuild(AbstractStep[List[str]]):
|
||||
self.docker_compose_path = docker_compose_path
|
||||
self.docker_repo_url = docker_repo_url
|
||||
self.publish = publish
|
||||
self.build_cache = build_cache
|
||||
|
||||
def progress(self) -> List[str]:
|
||||
"""
|
||||
@@ -91,7 +94,7 @@ class DockerComposeBuild(AbstractStep[List[str]]):
|
||||
pass
|
||||
|
||||
logger.info(f"Building image {image} from {build_ctx}, {build_dockerfile}")
|
||||
client.images.build(path=build_ctx, dockerfile=build_dockerfile, tag=image, nocache=True, rm=True)
|
||||
client.images.build(path=build_ctx, dockerfile=build_dockerfile, tag=image, nocache=not self.build_cache, rm=True)
|
||||
|
||||
if self.publish:
|
||||
logger.info(f"Pushing image {image}")
|
||||
|
||||
Reference in New Issue
Block a user