2019-07-02 20:16:44 +00:00
|
|
|
from . import fmt
|
|
|
|
from . import utils
|
|
|
|
|
|
|
|
|
2019-10-22 14:13:50 +00:00
|
|
|
def get_tag(config, name):
|
2020-07-21 07:13:00 +00:00
|
|
|
return config["DOCKER_IMAGE_" + name.upper().replace("-", "_")]
|
2019-10-22 14:13:50 +00:00
|
|
|
|
|
|
|
|
2019-07-02 20:16:44 +00:00
|
|
|
def build(path, tag, no_cache=False, build_args=None):
|
|
|
|
fmt.echo_info("Building image {}".format(tag))
|
|
|
|
command = ["build", "-t", tag, path]
|
|
|
|
build_args = build_args or {}
|
|
|
|
if no_cache:
|
|
|
|
command.append("--no-cache")
|
|
|
|
for arg in build_args:
|
|
|
|
command += ["--build-arg", arg]
|
|
|
|
utils.docker(*command)
|
|
|
|
|
2019-07-03 14:09:33 +00:00
|
|
|
|
2019-07-02 20:16:44 +00:00
|
|
|
def pull(tag):
|
|
|
|
fmt.echo_info("Pulling image {}".format(tag))
|
|
|
|
utils.execute("docker", "pull", tag)
|
|
|
|
|
2019-07-03 14:09:33 +00:00
|
|
|
|
2019-07-02 20:16:44 +00:00
|
|
|
def push(tag):
|
|
|
|
fmt.echo_info("Pushing image {}".format(tag))
|
2019-07-03 14:09:33 +00:00
|
|
|
utils.execute("docker", "push", tag)
|