How to use the spython.main.parse.parsers.DockerParser function in spython

To help you get started, we’ve selected a few spython examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github systemslab / popper / cli / popper / gha.py View on Github external
def convert(dockerfile, singularityfile):
        """Convert a Dockerfile to a Singularity recipe file.

        Args:
          dockerfile(str): The path to the Dockerfile.
          singularityfile(str): The path to the Singularity recipe.

        Returns:
          str: The Singularity recipefile path.
        """
        parser = DockerParser(dockerfile)
        for p in parser.recipe.files:
            p[0] = p[0].strip('\"')
            p[1] = p[1].strip('\"')
            if os.path.isdir(p[0]):
                p[0] += '/.'

        writer = SingularityWriter(parser.recipe)
        recipe = writer.convert()
        with open(singularityfile, 'w') as sf:
            sf.write(recipe)
        return singularityfile
github systemslab / popper / src / popper / runner_host.py View on Github external
def _convert(dockerfile, singularityfile):
        parser = DockerParser(dockerfile)
        for p in parser.recipe.files:
            p[0] = p[0].strip('"')
            p[1] = p[1].strip('"')
            if os.path.isdir(p[0]):
                p[0] += "/."

        writer = SingularityWriter(parser.recipe)
        recipe = writer.convert()
        with open(singularityfile, "w") as sf:
            sf.write(recipe)
        return singularityfile