Add 'no libs volumes' mode
This commit is contained in:
parent
546e62e077
commit
4c4fd6d42c
|
@ -12,6 +12,9 @@ def run_profile_hooks(profile, step, **kwargs):
|
||||||
hook_path = os.path.join(hooks_dir, trimmed_hook_name)
|
hook_path = os.path.join(hooks_dir, trimmed_hook_name)
|
||||||
run([hook_path], **kwargs)
|
run([hook_path], **kwargs)
|
||||||
|
|
||||||
|
def get_base_dir():
|
||||||
|
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/..")
|
||||||
|
|
||||||
def get_hooks_dir():
|
def get_hooks_dir():
|
||||||
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/../hooks")
|
return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/../hooks")
|
||||||
|
|
||||||
|
|
15
package
15
package
|
@ -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("--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("--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("--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
|
return parser
|
||||||
|
|
||||||
def build_image(build_workspace, base_image, profile_name, profile, debug=False, rebuild=False):
|
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:
|
with open("{:s}/Dockerfile".format(build_workspace), 'w') as dockerfile:
|
||||||
dockerfile.write("FROM {:s}\n".format(base_image))
|
dockerfile.write("FROM {:s}\n".format(base_image))
|
||||||
|
dockerfile.write("COPY .tamarin /tamarin\n")
|
||||||
|
|
||||||
# Configure "containerbuild" hooks environment
|
# Configure "containerbuild" hooks environment
|
||||||
hooks_env = os.environ.copy()
|
hooks_env = os.environ.copy()
|
||||||
|
@ -107,12 +110,16 @@ if __name__ == "__main__":
|
||||||
docker_args += [
|
docker_args += [
|
||||||
"-v", "{:s}:/src:ro".format(project_dir),
|
"-v", "{:s}:/src:ro".format(project_dir),
|
||||||
"-v", "{:s}:/dist".format(output_dir),
|
"-v", "{:s}:/dist".format(output_dir),
|
||||||
"-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()),
|
|
||||||
"-v", "{:s}:/tamarin/utils:ro".format(tamarin.get_utils_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()),
|
||||||
|
"-v", "{:s}:/tamarin/utils:ro".format(tamarin.get_utils_dir())
|
||||||
|
]
|
||||||
|
|
||||||
# Use environment proxy if defined
|
# Use environment proxy if defined
|
||||||
for proxy_var in ['HTTP_PROXY', 'HTTPS_PROXY', 'http_proxy', 'https_proxy']:
|
for proxy_var in ['HTTP_PROXY', 'HTTPS_PROXY', 'http_proxy', 'https_proxy']:
|
||||||
if proxy_var in os.environ:
|
if proxy_var in os.environ:
|
||||||
|
|
Loading…
Reference in New Issue