diff --git a/pyrex.py b/pyrex.py index 090e403..9beca61 100755 --- a/pyrex.py +++ b/pyrex.py @@ -212,7 +212,7 @@ def build_image(config, build_config): tag = config["config"]["tag"] - if config["config"]["buildlocal"] == "1": + if os.environ.get("PYREX_BUILD_LOCAL", config["config"]["buildlocal"]) == "1": if VERSION_TAG_REGEX.match(tag.split(":")[-1]) is not None: sys.stderr.write( "Image tag '%s' will overwrite release image tag, which is not what you want\n" @@ -406,9 +406,9 @@ def prep_container( "WARNING: buildid for container image %s has changed\n" % runid ) - if config["config"]["buildlocal"] == "1" and build_config["build"][ - "buildhash" - ] != get_build_hash(config): + if os.environ.get( + "PYREX_BUILD_LOCAL", config["config"]["buildlocal"] + ) == "1" and build_config["build"]["buildhash"] != get_build_hash(config): sys.stderr.write( "WARNING: The container image source has changed and should be rebuilt.\n" "Try running: 'pyrex-rebuild'\n"