2021-04-06 10:09:00 +00:00
|
|
|
from . import fmt, utils
|
|
|
|
from .types import Config, get_typed
|
2021-02-25 08:09:14 +00:00
|
|
|
|
2019-07-02 20:16:44 +00:00
|
|
|
|
2021-04-06 10:09:00 +00:00
|
|
|
def get_tag(config: Config, name: str) -> str:
|
|
|
|
key = "DOCKER_IMAGE_" + name.upper().replace("-", "_")
|
|
|
|
return get_typed(config, key, str)
|
2019-10-22 14:13:50 +00:00
|
|
|
|
|
|
|
|
2021-02-25 08:09:14 +00:00
|
|
|
def build(path: str, tag: str, *args: str) -> None:
|
2019-07-02 20:16:44 +00:00
|
|
|
fmt.echo_info("Building image {}".format(tag))
|
2020-09-04 10:35:44 +00:00
|
|
|
utils.docker("build", "-t", tag, *args, path)
|
2019-07-02 20:16:44 +00:00
|
|
|
|
2019-07-03 14:09:33 +00:00
|
|
|
|
2021-02-25 08:09:14 +00:00
|
|
|
def pull(tag: str) -> None:
|
2019-07-02 20:16:44 +00:00
|
|
|
fmt.echo_info("Pulling image {}".format(tag))
|
2020-11-14 11:26:06 +00:00
|
|
|
utils.docker("pull", tag)
|
2019-07-02 20:16:44 +00:00
|
|
|
|
2019-07-03 14:09:33 +00:00
|
|
|
|
2021-02-25 08:09:14 +00:00
|
|
|
def push(tag: str) -> None:
|
2019-07-02 20:16:44 +00:00
|
|
|
fmt.echo_info("Pushing image {}".format(tag))
|
2020-11-14 11:26:06 +00:00
|
|
|
utils.docker("push", tag)
|