mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-06-26 16:53:28 +00:00
22 lines
673 B
Python
22 lines
673 B
Python
from tutor import fmt, hooks, utils
|
|
|
|
|
|
def build(path: str, tag: str, *args: str) -> None:
|
|
fmt.echo_info(f"Building image {tag}")
|
|
build_command = ["build", f"--tag={tag}", *args, path]
|
|
# `buildx` can be removed once Tutor requires Docker v23+. At that point, BuildKit will be
|
|
# enabled by default for all Docker users.
|
|
build_command.insert(0, "buildx")
|
|
command = hooks.Filters.DOCKER_BUILD_COMMAND.apply(build_command)
|
|
utils.docker(*command)
|
|
|
|
|
|
def pull(tag: str) -> None:
|
|
fmt.echo_info(f"Pulling image {tag}")
|
|
utils.docker("pull", tag)
|
|
|
|
|
|
def push(tag: str) -> None:
|
|
fmt.echo_info(f"Pushing image {tag}")
|
|
utils.docker("push", tag)
|