Add 'no libs volumes' mode

This commit is contained in:
wpetit 2021-02-25 08:42:54 +01:00
parent 546e62e077
commit 4c4fd6d42c
2 changed files with 14 additions and 4 deletions

View File

@ -12,6 +12,9 @@ def run_profile_hooks(profile, step, **kwargs):
hook_path = os.path.join(hooks_dir, trimmed_hook_name)
run([hook_path], **kwargs)
def get_base_dir():
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/..")
def get_hooks_dir():
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/../hooks")

View File

@ -23,13 +23,16 @@ def create_args_parser():
parser.add_argument("--cleanup", help="Clear the workspace and remove obsolete Docker images before build", action="store_true", default=False)
parser.add_argument("--override-docker-args", help="Override all 'docker run' arguments. Use '[IMAGE_TAG]', '[PROFILE]' and '[ARCH]' to insert the corresponding values into your command.", default="")
parser.add_argument("--prepare-only", help="Only prepare build environment for the given profile", action="store_true", default=False)
parser.add_argument("--no-lib-mounts", help="Disable Tamarin library volumes mount", action="store_true", default=False)
return parser
def build_image(build_workspace, base_image, profile_name, profile, debug=False, rebuild=False):
shutil.copytree(tamarin.get_base_dir(), os.path.join(build_workspace, '.tamarin'))
with open("{:s}/Dockerfile".format(build_workspace), 'w') as dockerfile:
dockerfile.write("FROM {:s}\n".format(base_image))
dockerfile.write("COPY .tamarin /tamarin\n")
# Configure "containerbuild" hooks environment
hooks_env = os.environ.copy()
@ -107,6 +110,10 @@ if __name__ == "__main__":
docker_args += [
"-v", "{:s}:/src:ro".format(project_dir),
"-v", "{:s}:/dist".format(output_dir),
]
if not args.no_lib_mounts:
docker_args += [
"-v", "{:s}:/tamarin/hooks:ro".format(tamarin.get_hooks_dir()),
"-v", "{:s}:/tamarin/lib:ro".format(tamarin.get_lib_dir()),
"-v", "{:s}:/tamarin/profiles:ro".format(tamarin.get_profiles_dir()),