Skip to content

Commit

Permalink
Update script for ci image publish (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinxc authored Dec 8, 2023
1 parent e9aa3dc commit 71efa3f
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions publish_docker_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def main():
parser = argparse.ArgumentParser(description="Publish SecretFlow docker images")

parser.add_argument(
"--name",
metavar="name of docker image",
"--file",
metavar="filename of dockerfile",
type=str,
help="name of docker image",
help="filename of dockerfile",
required=True,
)

Expand All @@ -63,11 +63,13 @@ def main():

args = parser.parse_args()

dockerfile = os.path.join("dockerfiles", f"{args.name}.DockerFile")
versioned_tag = f"secretflow/{args.name}:{args.tag}"
latest_tag = f"secretflow/{args.name}:latest"
name, _ = os.path.splitext(args.file)

print(f"{COLOR_GREEN}Build docker image {args.name}{COLOR_END}")
dockerfile = os.path.join("dockerfiles", f"{args.file}")
versioned_tag = f"secretflow/{name}:{args.tag}"
latest_tag = f"secretflow/{name}:latest"

print(f"{COLOR_GREEN}Build docker image {name}{COLOR_END}")

if _check_is_multiarch_dockerfile(dockerfile):
print(f"{COLOR_GREEN}Creating buildx")
Expand Down Expand Up @@ -104,7 +106,7 @@ def main():
],
".",
)
print(f"{COLOR_GREEN}Build latest docker image {args.name}{COLOR_END}")
print(f"{COLOR_GREEN}Build latest docker image {name}{COLOR_END}")
_run_shell_command_with_live_output(
[
"docker",
Expand Down Expand Up @@ -139,10 +141,10 @@ def main():
_run_shell_command_with_live_output(
["docker", "tag", versioned_tag, latest_tag], "."
)
print(f"{COLOR_GREEN}[3/4] Push versioned tag to registry{COLOR_END}")
_run_shell_command_with_live_output(["docker", "push", versioned_tag], ".")
print(f"{COLOR_GREEN}[4/4] Push latest tag to registry{COLOR_END}")
_run_shell_command_with_live_output(["docker", "push", latest_tag], ".")
# print(f"{COLOR_GREEN}[3/4] Push versioned tag to registry{COLOR_END}")
# _run_shell_command_with_live_output(["docker", "push", versioned_tag], ".")
# print(f"{COLOR_GREEN}[4/4] Push latest tag to registry{COLOR_END}")
# _run_shell_command_with_live_output(["docker", "push", latest_tag], ".")



Expand Down

0 comments on commit 71efa3f

Please sign in to comment.