Skip to content

Commit

Permalink
remove implicit py tag from docker
Browse files Browse the repository at this point in the history
  • Loading branch information
supersergiy committed Jan 24, 2025
1 parent 68e5fd1 commit a4e710e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions build_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import argparse
import subprocess

BUILD_COMMAND_TMPL = "docker build --network=host -t {REGION}-docker.pkg.dev/{PROJECT}/{REPO}/zetta_utils:py{PYTHON_VERSION}_{TAG} --build-arg PYTHON_VERSION={PYTHON_VERSION} -f docker/Dockerfile.{MODE} ."
PUSH_COMMAND_TMPL = "docker push {REGION}-docker.pkg.dev/{PROJECT}/{REPO}/zetta_utils:py{PYTHON_VERSION}_{TAG}"
BUILD_COMMAND_TMPL = "docker build --network=host -t {REGION}-docker.pkg.dev/{PROJECT}/{REPO}/zetta_utils:{TAG} --build-arg PYTHON_VERSION={PYTHON_VERSION} -f docker/Dockerfile.{MODE} ."
PUSH_COMMAND_TMPL = "docker push {REGION}-docker.pkg.dev/{PROJECT}/{REPO}/zetta_utils:{TAG}"


def main():
Expand All @@ -27,15 +27,17 @@ def main():
choices=["3.12", "3.11", "3.10"],
help="Which python version to use for the image.",
)
parser.add_argument("--region", type=str, default="us-central1", help="Artifact Registry region.")
parser.add_argument(
"--region", type=str, default="us-central1", help="Artifact Registry region."
)
parser.add_argument("--repo", type=str, default="zutils", help="Artifact Registry repo name.")

args = parser.parse_args()

build_command = BUILD_COMMAND_TMPL
build_command = build_command.replace("{TAG}", args.tag)
build_command = build_command.replace("{MODE}", args.mode)
build_command = build_command.replace("{PYTHON_VERSION}", args.python.replace('.', ''))
build_command = build_command.replace("{PYTHON_VERSION}", args.python.replace(".", ""))
build_command = build_command.replace("{PROJECT}", args.project)
build_command = build_command.replace("{REGION}", args.region)
build_command = build_command.replace("{REPO}", args.repo)
Expand All @@ -44,7 +46,7 @@ def main():

push_command = PUSH_COMMAND_TMPL
push_command = push_command.replace("{TAG}", args.tag)
push_command = push_command.replace("{PYTHON_VERSION}", args.python.replace('.', ''))
push_command = push_command.replace("{PYTHON_VERSION}", args.python.replace(".", ""))
push_command = push_command.replace("{PROJECT}", args.project)
push_command = push_command.replace("{REGION}", args.region)
push_command = push_command.replace("{REPO}", args.repo)
Expand Down

0 comments on commit a4e710e

Please sign in to comment.