From 982a793b74a27acade8b7d2b95459757ab2c1bde Mon Sep 17 00:00:00 2001 From: Marco Donadoni Date: Tue, 24 Oct 2023 12:11:19 +0200 Subject: [PATCH] release-docker: add registry option --- reana/reana_dev/release.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/reana/reana_dev/release.py b/reana/reana_dev/release.py index ca95762a..d4db42ab 100644 --- a/reana/reana_dev/release.py +++ b/reana/reana_dev/release.py @@ -84,9 +84,12 @@ def release_commands(): ) @click.option("--user", "-u", default="reanahub", help="DockerHub user name [reanahub]") @click.option("--image-name", help="Should the component have a custom image name?") +@click.option( + "--registry", "-r", default="docker.io", help="Registry to use in the image tag" +) @release_commands.command(name="release-docker") @click.pass_context -def release_docker(ctx, component, user, image_name): # noqa: D301 +def release_docker(ctx, component, user, image_name, registry): # noqa: D301 """Release a component on Docker Hub. \b @@ -113,13 +116,19 @@ def release_docker(ctx, component, user, image_name): # noqa: D301 if not is_component_dockerised(component_): cannot_release_on_dockerhub.append(component_) is_component_releasable(component_, exit_code=True, display=True) - full_image_name = f"{user}/{image_name or component_}" + full_image_name = f"{registry}/{user}/{image_name or component_}" docker_tag = get_docker_tag(component_) run_command( f"docker tag {full_image_name}:latest {full_image_name}:{docker_tag}", component_, ) - ctx.invoke(docker_push, component=[component_], tag=docker_tag, user=user) + ctx.invoke( + docker_push, + component=[component_], + tag=docker_tag, + user=user, + registry=registry, + ) if cannot_release_on_dockerhub: click.secho(